Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Widget Bitmap Sizes
    text
    copied!<p>Hallo,</p> <p>I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density.</p> <p>According to the <a href="http://developer.android.com/guide/topics/appwidgets/index.html#MetaData" rel="noreferrer">Android Developer App Widgets</a> tutorial:</p> <pre><code>To find your minimum width and height in density-independent pixels (dp), use this formula: (number of cells * 74) - 2 Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells </code></pre> <p>So if my widget is 72dp x 294dp, what size bitmaps do I need for my ldpi, mdpi and hdpi drawables?</p> <p>Also, will I need any particular supports-screens settings in my manifest?</p> <p>TIA,</p> <p>-Frink</p> <p>Update: I've made some checkerboard patterns in various sizes and colours for each drawable- folder and tried them out. Is this density thing a bit of a red herring?</p> <p>I've just done a screen-grab of my emulator running as HVGA, medium density, 320x480. The size taken up by my widget is 320x100, so I create a 320x100 bitmap in the mdpi folder as a background for my widget it looks perfect both on my emulator and LG GT540.</p> <p>And for an emulator running as WVGA854, high density, 480x854. The size of my widget is 480x150. Creating a background this size and placing it in the hdpi folder displays correctly on this emulator. I have no hardware to test this on tho :-(</p> <p>Update2: I think I can explain my problem better now :-)</p> <p>If I have three devices:</p> <pre><code>Device1, resolution 320x480, density ldpi Device2, resolution 320x480, density mdpi Device3, resolution 400x854, density mdpi </code></pre> <p>The physical size of the screens would probably all be different, but I don't think the actual sizes matter</p> <p>I've worked out that Device1 and Device2 will need a background of 320x100, whereas Device3 will need 400x150 So what size background goes into the mdpi folder to display properly on Device2 and Device3?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload