Is it possible to give one set of dimen values for xhdpi
and above densities and another set of dimen values for hdpi
and below densities in android? I have been trying to accomplish this by creating one values-xhdpi
folder for xhdpi
and above densities and keeping values
folder for other densities.
Is this approach correct, because I am not getting expected results. If no then what is the right approach to accomplish this?
Yes, your approach is partially correct according to https://developer.android.com/guide/practices/screens_support.html#support
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
That means if you will have for example xxhdpi
screen, system will pick resources from xhdpi
folder.
But if you want to use hdpi
resources for all the below density screens, you should provide values-hdpi rather than just values
.
You can find this quote in the documentation:
The system assumes that default resources (those from a directory without configuration qualifiers) are designed for the baseline screen density (
mdpi
), unless they are loaded from a density-specific resource directory.
So there is no guaranty that system will pick your resources from values
folder for hdpi
screen.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.