开发者

Android: Is there a way to get the size of a RemoteViews object?

开发者 https://www.devze.com 2023-02-28 06:22 出处:网络
In my app widget, I have a LinearLayout whose height and width are set to fill_parent. Is there a way to get at runtime, the actual s开发者_运维百科ize that has been allocated to this view?The app wid

In my app widget, I have a LinearLayout whose height and width are set to fill_parent. Is there a way to get at runtime, the actual s开发者_运维百科ize that has been allocated to this view?


The app widget meta data XML file determines the overall size of your widget; you must design your layouts with that size in mind. If you are implementing multiple size widgets, you will need a separate meta data and layout for each one.

The app widget system uses an abstract "grid units" that you can turn into DP, see this page for details. If you set the size incorrectly, it will just "truncate" to the nearest grid size on your behalf (and your layout will look "bad").

Android 3 and 4 give you more possibility for sizing.

0

精彩评论

暂无评论...
验证码 换一张
取 消