0

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

Parad0X
  • 3,634
  • 2
  • 12
  • 23
  • "I have dimens on xxhdpi with values" -- this is the wrong answer. If you are using units that vary by density (e.g., `dp`), you should have no reason to create different dimension values using density resource sets. Having different dimension values based on screen size (e.g., larger margins on larger screens) is fine. – CommonsWare Sep 14 '17 at 16:17

1 Answers1

2

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).

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120
  • xiaomi its xxhdpi nexus 5 its too xxhdpi but wrong. nexus 5X have own dimens (values-sw410dp) and i want put extra values for nexus 5. – Parad0X Sep 14 '17 at 16:15
  • It is guaranteed that if it looks bad on the Nexus 5 it will look bad on any other device with the same density and the same screen size. You don't want to target the Nexus 5 specifically- figure out what aspect of the Nexus 5 is the problem and go from there. – Bryan Herbst Sep 14 '17 at 16:20