What happens if we provide alternate drawable resources?

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?

-------------Problems Reply------------

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.

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?

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

Category:android Views:5 Time:2018-03-07

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.076 (s). 11 q(s)