开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜