Resolution specific dimensions are not working as expected in Android

30 Views Asked by At

I had to adjust the layout dimensions for HDPI devices. So, I added the dimensions in values-hdpi folder.

dimen decleration in values-hdpi folder

<resources>
    <dimen name="tracking_activity_marging_top">8dp</dimen>
</resources>

dimenn decleration in values folder

<resources>
  <dimen name="tracking_activity_marging_top">14dp</dimen>
</resources>

The dimen value defined in values-hdpi folder is correctly picked in HDPI device. But, XXHDPI device (and device with non-hdpi resolution) picked the value from values-hdpi folder instead of normal values folder.

Why non-hdpi devices are picking values from hdpi folder? How can I solve it?

  • The issue is happening in a library module. The dimens are picking correctly in app module.
1

There are 1 best solutions below

1
T LABS On

Each modules have its own resource folder, you might want to add dimens qualifier depending on screen dpi for library module too.