Hallo,
I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density.
According to the Android Developer App Wi
You just need to convert 72dp x 294dp into actual pixel sizes for ldpi
, mdpi
, and hdpi
. That process is explained here:
http://developer.android.com/guide/practices/screens_support.html
The formula is pixels = dps * (density / 160)
, so in your case, 72 dp x 294 dp would equal:
Update in response to your second update: Density-based resources are aimed at making sure that graphics are (roughly) the same actual size across devices. In your case, though, you don't care about the actual size, you care about the background filling up whatever space it is supposed to fill for the widget. You should be able to handle this issue for most backgrounds by created an Nine Patch image. The Nine Patch will scale according to the size required.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
http://developer.android.com/guide/developing/tools/draw9patch.html
There is good advice from Google on icon sizes here: http://developer.android.com/guide/practices/ui_guidelines/icon_design.html
I guess they should apply to custom widgets too.