Reputation: 2106
Lets say I have an image image.png in drawable, drawable-hdpi, drawable-xhdpi. In case if I run the app in an xxhdpi device which image would be taken up by the device?
Upvotes: 0
Views: 99
Reputation: 17429
The Arnis's answer is correct, but not complete.
The generic rule is that Android system looks for a "match" for the requested resource, but this actually doesn't mean that if it can't find a specific resource size it will use the "default" resource. Indeed the documentation says:
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.
So, answering the question, on a xxhdpi device, probably Android will look for the "closer" (in terms of resolution) resource.
Upvotes: 0
Reputation: 544
If no matching resource is available, the system uses the default resource and scales it up or down as needed to match the current screen size and density
The "default" resources are those that are not tagged with a configuration qualifier. For example, the resources in drawable/ are the default drawable resources.
For more detail go to Supporting Multiple Screens.
Upvotes: 1