-1

in my App I have 2 different layouts for the same layout.

  1. normal
  2. sw420dp

both are the same with just minor fixes for bigger dpi screen however when i launch the emulator with the nexus 5 1920x1080 420 dpi it shows me the "normal" layout rather then the -sw420dp one , have i wrote it incorrectly cause i double checked and everything seems to be in order however it dose not work well...

please help.

example

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

1 Answers1

0

The -swXXXdp resource directory suffix stands for "smallest width: XXX dp". It is meant to be used to differentiate between different screen sizes, not different screen densities.

From the Android developer guides:

px = dp * (dpi / 160)

So for you, 1080 = dp * (420 / 160), or dp = 411.42.

Since 411.42 is less than 420, your phone will display the "normal" layout.

Ben P.
  • 52,661
  • 6
  • 95
  • 123