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 size 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With