0

I have the next problem:

I have a folder name layout (path: res/layout/...) that contains some activities. I create another folder name layout-xhdpi (path: res/layout-xhdpi/...) with the same activities. I added to the main activity inside layout-xhdpi a textView that shows "You enter in xhdpi".

The problem is that when i run the app in a Samsung S4 that is a xxhdpi, it opens the activity XHDPI, not enter to res/layout/...

Why is this happening?

Greetings

user3240604
  • 407
  • 1
  • 8
  • 22

2 Answers2

0

Android selects the version of each resource that best matches the current device.

See: http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources

In section "Screen pixel density (dpi)":

Note: Using a density qualifier does not imply that the resources are only for screens of that density. If you do not provide alternative resources with qualifiers that better match the current device configuration, the system may use whichever resources are the best match.

Zikkoua
  • 806
  • 7
  • 9
0

That's normal, layout-xhdpi will be used for xhdpi devices and higher, unless you have other layouts for bigger dpi (e.g. layout-xxhdpi). The default folder will be used for devices with lower resolution.

Ruocco
  • 575
  • 2
  • 12
  • 26
  • i have anither question. Im testing my app in a Samsung S4 and a Sony Xperia Z. Both have 1080 x 1920, 5'' screen, bothe xxhdpi. The problem is in sony xperia z the views are not in the wright position... why this happens? – user3240604 May 26 '15 at 03:08