4

I have doubt that how we are going to create the different layouts to support all android mobile devices. As we know that we will be creating different layouts (mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi..) in res folder. What is my question is eg: I am having two mobiles say moto e(253dpi) and samsung galaxy e7(267dpi) where both are xhpdi. Now I will be creating xhdpi for them. But here the two screen resolutions differs (moto e(540x960) and e7(720x1280) respectively).

Now if I give some hard coded values in xhpdi xml. Whether my layout remains same for both devices? Without any alignment issues?

ppreetikaa
  • 1,149
  • 2
  • 15
  • 22
Asif Sb
  • 785
  • 9
  • 38
  • Refer to this document: http://developer.android.com/guide/practices/screens_support.html – Phantômaxx Jul 06 '15 at 09:52
  • Don't give hard coded value to them, use different folders for them – Namrata Jul 06 '15 at 10:10
  • @DerGolem..Thanks for your suggestion,but I have gone through that link already.so i got this doubt. – Asif Sb Jul 06 '15 at 10:14
  • @Dorami..I have gone through few links they said to use relative layout,where in some cases i will be setting a view android:layout_marginTop="80dp"..so what happen in this case? – Asif Sb Jul 06 '15 at 10:16

1 Answers1

1

Use following folders if you wish to have tablet-specific layouts:

layout-large-mdpi   (1024x600)
layout-large-xhdpi  (1200x1920)
layout-xlarge-mdpi  (1280x800)
layout-xlarge-xhdpi (2560x1600)

For Mobiles:

res/drawable        (default)
res/drawable-ldpi  (240x320)
res/drawable-mdpi  (320x480)
res/drawable-hdpi  (480x800)
res/drawable-xhdpi  (720x1280)
res/drawable-xxhdpi (1080x1920)
res/drawable-xxxhdpi (1440X2560)

Dinems for mobiles:

res/values/dimens.xml(default)
res/values-ldpi/dimens.xml   (240x320)
res/values-mdpi/dimens.xml   (320x480)
res/values-hdpi/dimens.xml   (480x800)
res/values-xhdpi/dimens.xml  (720x1280)
res/values-xxhdpi/dimens.xml (1080x1920)
Namrata
  • 1,683
  • 1
  • 17
  • 28