Reputation: 557
This is on Jelly Bean, and so the widget can be resizable by the user. The only thing in my widget is an Image View. I am creating a bitmap whenever the widget updates which I set into the Image View itself via remote views. The bitmap created and drawn changes depending on the size of the widget, and the space taken up by it.
The problem I have is in determining what size to create the bitmap which I understands must use pixels. Is there a way to find this out from the widget provider? Either the space available in pixels or dips will be fine as I should be able to work it out from one to the other.
Upvotes: 1
Views: 2172
Reputation: 455
The size in dip of a widget can be calculated using the following formula: 70 × n − 30
where n
is the number of cells in either width or height.
You can convert dp values to pixels depending on the screen density.
Read more at: http://developer.android.com/guide/practices/ui_guidelines/widget_design.html
Upvotes: 1