0

I'm developing an android app. I've done much so far, but I've some problems. So far, I've compiled the app on Nexus 5 and I've designed the layout for that device. I know that, I should have different layout folders for different screen categories, but my problem is that, for example, my app works pretty good on Nexus 5, but not good on Nexus S.

And I also know that those 2 devices are in the same layout category.

How can I solve this issue? I want a layout for Nexus S which differs Nexus 5.

Note: Please, do not comment documentation links. I've read them all, but couldn't solve my problem.

Thanks!

Rami
  • 7,879
  • 12
  • 36
  • 66
Alvin
  • 894
  • 8
  • 16
  • Possible duplicate of [Difference between px, dp, dip and sp on Android?](http://stackoverflow.com/questions/2025282/difference-between-px-dp-dip-and-sp-on-android) – Alvin Apr 25 '16 at 13:25

1 Answers1

1

From official documentation:

  • ldpi (low) ~120dpi
  • mdpi (medium) ~160dpi
  • hdpi (high) ~240dpi
  • xhdpi (extra-high) ~320dpi
  • xxhdpi (extra-extra-high) ~480dpi
  • xxxhdpi (extra-extra-extra-high) ~640dpi

Using desnity:

Nexus 5 is ~445 dpi => belong to xhdpi category.

Nexus S is ~233 dpi => belong to mdpi category.

So you can use layout-xhdpi directory for Nexus 5, and layout-mdpi directory for Nexus S.


UPDATE

Using dimensions:

Nexus 5 is 1080 x 1920 pixels. => layout-1080x1920 directory

Nexus S is 480 x 800 pixels. => layout-480x800 directory (or just the default one)

Rami
  • 7,879
  • 12
  • 36
  • 66
  • Thanks for your answer, @Rami. But the result is the same; xhdpi was chosen for both devices. – Alvin Dec 17 '15 at 09:00
  • @user3163150 I don't have physical devices for test, but that's strange. Give a try with dimension, check my update. – Rami Dec 17 '15 at 09:12
  • I use Nexus S as emulator and Nexus 5 as physical device. As of now, I have **layout-480x800** folder and **activity_login.xml** in it. Running with Nexus S emulator, I get the view from layout-xhdpi folder @Rami – Alvin Dec 17 '15 at 09:22
  • Remove *activity_login.xml* from *layout-xhdpi* folder, add it in *layout-480x800* and another one in *layout-1080x1920* . – Rami Dec 17 '15 at 09:25
  • Again the same layout. **layout-480x800** @Rami – Alvin Dec 17 '15 at 11:10
  • I just tested it in my 2 emulators and works fine. Make sure you have *activity_login.xml* **ONLY** in *layout-480x800* and *layout-1080x1920* directories. – Rami Dec 17 '15 at 12:06