I'm having a real problem with my drawables that I just can't seem to figure out.
The problem is this:
There are screen sizes at approximately 320x480, 480x800, 480x854
Then there are most commonly densities at 1.0 (160) and 1.5 (240)
Now, on a Droid, the screen size is 480x800 and the density is reporting using DisplayMetrics as 1.5
On the G1, it's 320x480 and reporting back at a density of 1.0
BUT tablet devices are reporting back at 480x800 with a density of 1.0 (160)
So, I'm going mad because I can put 320x480 images in the drawables-mdpi folder and 480x800 images in the drawables-hdpi folder, but on Tablet computers, no matter what it's not resizing up anything to a full screen.
Any help would be greatly appreciated. I just want all of my 320x480 images to scale up regardless of the device.
You might be missing some tags in your manifest such as anyDensity
and supports...
. Decent tablet support only came with xlarge
(in Gingerbread I think).
Also if you are drawing yourself, you need to call setTargetDensity(actualDensity)
on your canvas, drawable, or bitmap (can't remember which of the three).
How are you applying the images? You can just use fill_parent for the layout_width/height of an ImageView, and select fitCenter for the scaleType.
It's perfectly correct for the Galaxy Tab to be reporting as medium dpi (although I thought the resolution of the Tab was 1024 x 600?), even though it is a high resolution. The dpi is a measurement of the size of the pixels (e.g. the number of pixels in an inch). So a 480 x 800 resolution in a 4" screen will have a higher dpi than a 480 x 800 resolution in a 7" display, simply because they are compressed into a smaller space.
You can actually add an extra drawables folder called drawable-large-mdpi
that could contain files for a large screened medium dpi device, such as the Tab (see here for more information on those qualifiers).
The tablet is doing something wrong. Google specifically made it possible for the hardware manufacturer to declare hardware mpdi even if the dpi is about 160. The Galaxy Tab does this: http://realmike.org/blog/2010/12/21/multiple-screen-sizes-with-processing-for-android/
You can try to add a res/drawable-mdpi-xlarge and add hdpi graphics here. xlarge was introduced in 2.3 I think, and older Android versions won't recognize this. You might want to try drawable-mdpi-large then (as per http://blog.alsutton.com/2010/07/03/android-tablets-and-mdpi-large/)
Adding extra drawable folders adds to the size of your apk. In general, tablets before Gingerbread or better Honeycomb are tricky on Android and I wouldn't bother to do special stuff for them if you can avoid it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With