0

my app is choosing to show mdpi images over there hdpi twins on tablets, unless the mdpi images are removed, then it will gladly use my hdpi images. ive read the docs and other posts and ive tried adding the line;

<supports-screens
android:anyDensity="true"/>

in the manifest but this did nothing noticeable, my question is do the hdpi and mdpi HAVE to be 1.5x apart in size for instance if a 150x150 image is mdpi does the hdpi have to be 225x225 or could it for example be 224x224? does the android system find the closest fit or must it be a perfect match? and if not what could be the issue?

martinseal1987
  • 1,862
  • 8
  • 44
  • 77

1 Answers1

0

I don´t know it 100% but with what I know there is no restricction. What could help you is to create the next 3 folders: drawable-large drawable-xlarge-mdpi drawable-xxhdpi

Android is going to use these ones over the others if its a tablet.

Hope it helps at least.

  • 1
    Found this: However, when the system is looking for a density-specific resource and does not find it in the density-specific directory, it won't always use the default resources. The system may instead use one of the other density-specific resources in order to provide better results when scaling. For example, when looking for a low-density resource and it is not available, the system prefers to scale-down the high-density version of the resource. But it doesn't suggest why a tablet would grab a mdpi image over a hdpi, – martinseal1987 Jun 15 '14 at 18:42
  • changed my image sizes but no joy my hdpi is 384x653 my mdpi is 240x408 so its slightly off the 1.5x if it matters the resources are part of an xml frame animation ive used the same xml for both the mdpi and hdpi as nothing about those change does it? – martinseal1987 Jun 15 '14 at 23:31
  • 1
    Where are you creating your images? Here is the official android post about this kind of things : http://developer.android.com/design/style/iconography.html Are you changing the density of your images? Size is not as relevant as density. If you have a larger image with same density as the small one, its going to choose the small image because it has better resolution. Normally 300 dpi is considered a high resolution. That what I used for my project and it worked perfect. They recomend 640dpi for XXXHDPI but I think it´s a bit high. Tell me if this helps. –  Jun 16 '14 at 21:18
  • sorry missed your reply till now, how can I tell what DPI my images are? I thought it was just a translation between different measures like millimetres to inches, or grams into pounds, I haven't found a sure fire way around this I stuck my frame anim XML in drawables folder and that seems to have done the trick for my tablet and device but I don't have an mdpi device to test it on and my emulator just wants to crash recently on my laptop – martinseal1987 Jun 18 '14 at 14:05