6

I'm trying to create an appwidget that has a standard size of 4x2 tiles. Currently, I'm using these values:

android:minHeight="146dp"
android:minWidth="294dp"

On my Desire running Gingerbread, the widget shows as 4x2.
On my Asus TF101 tablet running ICS, the widget gets a size of 4x2.
Finally, in an emulator 720x1280 running ICS, the widget gets a size of 4x3.

So I'm a bit confused here. What are the correct values (perhaps using different resource folders) to achieve a 4x2 widget on all devices?

nhaarman
  • 98,571
  • 55
  • 246
  • 278

2 Answers2

3

I've found that working on approx. 72dp x 72dp per 1x1 works best. So for a 2x2 widget I would normally use 144dp x 144dp, however google recommends 110dp x 110dp.

This page from Google gives a better description of what size to use and how to calculate it: http://developer.android.com/guide/practices/ui_guidelines/widget_design.html

hyarion
  • 2,251
  • 2
  • 17
  • 28
  • 1
    This solution does not work on 7'' tablets. Checked on the Nexus 7 2013 and the widget size is 3x2 cells and horizontally cropped. On smartphones like the OnePlus One it is 4x2 cells and looks ok. Set to **280 dp** worked, now the cell sizes are 4x2 on all devices. – gpm Feb 01 '16 at 14:15
0

According to google guidelines you should use this formula : 70 × n − 30

For a 4*2 widget that means you should use 250dp * 110dp.

More infos : http://developer.android.com/guide/practices/ui_guidelines/widget_design.html

Giom
  • 133
  • 10