MarkJ
MarkJ

Reputation: 30408

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.

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

Upvotes: 3

Views: 1520

Answers (2)

Jeffrey Blattman
Jeffrey Blattman

Reputation: 22637

According to the appwidget design page, valid sizes are,

  1. 4x1
  2. 3x3
  3. 2x2

That being said, I've written 1x1 and 2x1 widgets and have not heard of them not working anywhere.

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1006869

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.

Upvotes: 4

Related Questions