androiddimensionsnexus-5

create dimens.xml only for Nexux 5


Hello I have a a problem with nexus 5

I have dimens on xxhdpi with values, on my Xiaomi mi3 its everything okay, but on nexus 5 its wrong UI, can I generate dimens only for Nexux 5 how?

Thanks


Solution

  • The first question to ask yourself is "why does this need to happen only on the Nexus 5?" What exactly about the Nexus 5 makes your UI display incorrectly?

    The answer is likely that it is something like the device's screen density or size, in which case you don't want a Nexus 5 specific configuration.

    If the issue is the screen density, you likely want different dimensions in an appropriate density folder (e.g. values-xhdpi/dimens.xml). If it is an issue with the overall screen size, maybe you want to break up your dimens in folders such as values-sw320dp/dimens.xml to target devices with a smallest width of at least 320dp.

    You should read the Providing Resources documentation to make sure you fully understand the different resource qualifiers.

    Also make sure that you are using dps (density-independent pixels) instead of px (pixels).