Hi,

I'm trying to understand how the home screen calculates how many cells
will be assigned to a given widget. I came across the following
sentence in the Android Developer Site:

"Because the Home screen's layout orientation (and thus, the cell
sizes) can change, as a rule of thumb, you should assume the worst-
case cell size of 74 pixels for the height and width of a cell.
However, you must subtract 2 from the final dimension to account for
any integer rounding errors that occur in the pixel count. To find
your minimum width and height in density-independent pixels (dp), use
this formula:
(number of cells * 74) - 2
Following this formula, you should use 72 dp for a height of one cell,
294 dp and for a width of four cells."

What if I have a mdpi (160dpi) device whose resolution is 480x800?

In a mdpi device, each 1 dip stands for 1 pixel. So, if my widget is
72dip x 294dip, it would take 72px x 294px in the mdpi device.
As far as I cound understand, in the example above, the widget would
not take 4 cells in this device. The device is 480 pixels wide and 294
pixels would be covered by 3 cells.

Who's wrong here? The formula or my interpretation?

Thanks in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to