开发者

Android widgets size - what if non-standard size is used?

Understand that 1x1 wi开发者_开发知识库dget size should be 72 dip x 72 dip, but this is seems to be less than standard icon size. If I change size to 80 dip x 80 dip, then it looks as the same. Is it OK if I would use this size?


Quoting the documentation:

The default Home screen positions App Widgets in its window based on a grid of cells that have a defined height and width. If the values for an App Widget's minimum width or height don't match the dimensions of the cells, then the App Widget dimensions round up to the nearest cell size. (See the App Widget Design Guidelines for more information on the Home screen cell sizes.)

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.

Those instructions are for "the default Home screen". Other home screen implementations may behave differently. If your widget layout and such will work well both at the regular size and your slightly larger size, in principle your 80dip will work -- just understand that your request for 8dip of additional space will typically be ignored.

Personally, I would use 72dip, to ensure compatibility.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜