0

If we provide an image for every density bucket i.e all the drawable folders (ldpi,mdpi,hpi,xhdpi,..etc) then android will pick the matching resources and will be displayed accordingly.

but what if we provide images for alternate drawable folder

  • mdpi
  • xhdpi
  • xxxhdpi

so my doubt is from where will the other phones with non specified drawable folder take resources from, will it take from the higher or from the lower?
For e.g hdpi devices will it take resources from mdpi folder or xhdpi folder?

Jeffy Lazar
  • 1,903
  • 13
  • 20

3 Answers3

2

According to the official documentation

Exception: If the qualifier in question is screen pixel density, Android selects the option that most closely matches the device screen density. In general, Android prefers scaling down a larger original image to scaling up a smaller original image. [...]

So it take the larger closest image to scale to hdpi density.

Hugo Gresse
  • 17,195
  • 9
  • 77
  • 119
  • thanks for providing the documentation link, this makes it much more clear and got the flow of how android eliminates resources. – Jeffy Lazar Apr 20 '15 at 07:49
0

Hdpi device will take from

xhdpi (if device configuration is set for this from manufecturer otherwise it will default fetch from simple values )

For any configuration, device manufacturer set properties.

Generally, for X configuration, if X is not defined then it will fetch from Y (Y > X) or /values

Kushal
  • 8,100
  • 9
  • 63
  • 82
0

The logic shows that it should take them from the first bigger size than the searched one, because if it takes the smaller one and resize it to a bigger one, it could make the quality worse. So it is logically right to get the bigger picture and resize it to a little bit smaller picture. One question that could be helpful for you (take a look at the best selected answer) How mdpi, hdpi, xhdpi folder works?

Community
  • 1
  • 1
Gabriella Angelova
  • 2,985
  • 1
  • 17
  • 30