Search code examples
androidandroid-appwidget

Are Android AppWidgets restricted to particular sizes?


I'm making an Android AppWidget to sit on the home screen.

The user's home screen space is precious, so I want the widget to be small. The ideal size would be 2x1 cells.

Is there any way to create a 2x1 widget, or should I use a standard size?

My widget was adapted from the Simple Wiktionary sample.

  • The manifest has android:minWidth="146dip" and android:minHeight="72dip".
  • There's a RelativeLayout with android:layout_width="fill_parent" and android:layout_height="wrap_content"

I'm just starting with Android, so apologies in advance if this is a silly question. :)


Solution

  • I'm just starting with Android, so apologies in advance if this is a silly question. :)

    It's definitely not a silly question.

    Does that refer to the available PhotoShop templates or is it a limitation of Android itself?

    I was under the impression that 2x1 was a legal size, but I have not tried one of that size.

    HTC have their own special implementation of the home screen, so maybe my widget will only work at 2x1 on HTC devices?

    Different home screen implementations might interpret the sizing differently, though I would hope that they would be generally consistent.

    Is there any way to create a 2x1 widget, or should I use a standard size?

    You could experiment with smaller android:minHeight values, to see if there is a new threshold you need to convince the emulator to give you a 2x1 app widget. That being said, you may have more consistent results with a 2x2 app widget.