naran z naran z - 1 year ago 228
Android Question

Android values in Nexus 4 and 5X

I know there are lot of questions/tutorials related to android layout and dimens design but I am facing one issue for the dimens. The issue is for the devices which are built with xhdpi or xxhdpi or xxxhdpi.

I have 4 values folder in my project:

  1. values-sw320dp

  2. values-sw420dp

  3. values-xhdpi

  4. values

When I run my project in Nexus 4, it loads the values from values-sw320dp

When I run my project in Nexus 5X, it loads the values from same folder i.e. values-sw320dp

Same case for Samsung galaxy s6, it also loads the values from same folder.

So, how can I separate the values folder for these two devices?
Can someone please help me to solve this out?

Answer Source

After the investigation and many of trial, I got solution for this. I am posting my solution here so that it can helpful to anyone in future.

Nexus 4 has a resolution of 384x640 dp with xhdpi density. So I used values-sw320dp-xhdpi for that

Nexus 5X has a resolution of 411x731 dp with xxhdpi density. So I used values-sw320dp-xxhdpi for that

Android Studio accepts it and respective devices also loads dimensions from respective values folders.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download