Search code examples
androidandroid-layoutandroid-screen-supportandroid-screen

Android is not picking right dimens.xml file from values folder


I have created different dimens.xml files and placed them in appropriate values folder.

I have the following "value" folders defined

values, values-large, values-normal, values-small, values-sw320dp, values-sw320dp-land, values-sw480dp, values-sw600dp, values-sw720dp and values-sw720dp-land

The problem is when I install the app on phone <= 5 inches, dimens.xml from values-sw320dp is selected by Android. The selection is independent of screen density.

I have tested the app on S4, Moto G, S4 Mini and some 2.3 device. The results are the same throughout.

What am I doing wrong here?


Solution

  • I don't know what is the problem in the way you are trying. But I always create values folders like this values, values-ldpi, values-mdpi, values-hdpi, values-xhdpi, values-w360dp-mdpi, values-w600dp-mdpi and so on. Its always work for me.