0

There is an app which I want to adopt to xhdpi resolution phones. So I made resources for that resolution and all went fine regarding the xhdpi phones.

I have a test mobile phone which is normal hdpi and the layout is now messed up (after I made fixes for xhdpi phones.

The layout structure looks like this:

/res/drawable-hdpi
/res/drawable-normal-xhdpi
/res/layout
/res/layout-normal-xhdpi

When I load the app on normal hdpi phone, I see that it uses layout from /res/layout-normal-xhdpi and images from /res/drawable-normal-xhdpi.

Shouldn't it use resources from the lower resource folder like /res/layout and /res/drawable-hdpi? It does not and I do not know why.

Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
sandalone
  • 41,141
  • 63
  • 222
  • 338

1 Answers1

1

According to How Android Finds the Best-matching Resource system eliminates resource files that contradict the device configuration, but it looks like your case is expected, because of this exception:

Exception: Screen pixel density is the one qualifier that is not eliminated due to a contradiction.

This way a device of normal hdpi configuration matches to /res/drawable-normal-xhdpi.

Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91