Jeffy Lazar
Jeffy Lazar

Reputation: 1923

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

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?

Upvotes: 0

Views: 147

Answers (3)

Kushal
Kushal

Reputation: 8478

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

Upvotes: 0

Hugo Gresse
Hugo Gresse

Reputation: 17879

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.

Upvotes: 2

Gabriella Angelova
Gabriella Angelova

Reputation: 2985

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?

Upvotes: 0

Related Questions