2

I am working on a mature app, trying to add specific dimension setting for the Google-Pixel phone.

AFAIU for Pixel I should put the specific value I need inside values-xxhdpi/dimens.xml. I created that path and file and placed the value including a qualifier tag - like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="qualifier">xxhdpi</string>

    <dimen name="my_value">48dp</dimen>

</resources>

I tried without the qualifier as well and also placing it in values-xxxhdpi.

The problem is that it doesn't catch and I suspect some other values-??? folder is catching somehow. There are quite a few of those so I am not sure which one.

Is there a way in debug time to know the exact resource file name/path being used?

drorsun
  • 881
  • 1
  • 8
  • 22

1 Answers1

2

You can check the density in your code.

    switch (getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
    // handle your code here for ldpi
    break;
case DisplayMetrics.DENSITY_MEDIUM:
    // handle your code here for mdpi
    break;
case DisplayMetrics.DENSITY_HIGH:
   // handle your code here for hdpi
    break;
case DisplayMetrics.DENSITY_XHIGH:
    // handle your code here for xhdpi
    break;
}

and Place a log and check which one is using

Ameer
  • 2,709
  • 1
  • 28
  • 44
  • I already did that and figured out is supposed to be xxhdpi. But applying that value in the values-xxhdpi folder didn't work. That's why I am asking if there's a way to know what actual resource folder/file is being used - for debug purposes. – drorsun Jan 18 '17 at 12:18
  • From Honeycomb values folder will create according to screen density like layout folders. eg: values320dp, values480dp – Ameer Jan 18 '17 at 13:01