1

what is the difference between layout-ldpi and layout-sw320.I mean when to use ldpi,mdpi,hdpi,xhdpi and when to use layout-sw?

Which one is to be used for the current version of android?

gauravsheohar
  • 396
  • 5
  • 12
  • 1
    Possible duplicate of [Drawable-hdpi, Drawable-mdpi, Drawable-ldpi Android](http://stackoverflow.com/questions/3263265/drawable-hdpi-drawable-mdpi-drawable-ldpi-android) – Iamat8 Feb 08 '16 at 12:22
  • 1
    Only difference is after and before API 13, layout-ldpi is before api level13 and layout-sw is using for versions above 13. – Remees M Syde Feb 08 '16 at 12:31

3 Answers3

2

Main difference is after and before API 13, layout-ldpi is before api level13 and layout-sw is using for versions above 13.

If you have layouts for larger screen devices such as tablets, now its the time to stop using the -large or -xlarge resource and switch to using -swXXdp or -wXXdp qualifiers. The latter were introduced in API level 13, which basically all tablets now have support for according to the latest platform version.

res/layout-xlarge/main_activity.xml    # For pre-3.2 tablets
res/layout-sw600dp/main_activity.xml   # For 3.2 and up tablets

Like

7" tablets: Instead of layout-large, use layout-sw600dp. 
10" tablets: Instead of layout-xlarge, use layout-sw720dp.
Remees M Syde
  • 2,564
  • 1
  • 19
  • 42
0

All these (ldpi , hdpi , mdpi, xhdpi , xxhdpi) use to provide multi screen support , Android devices are available in various screen resolutions , so to give Same look and feel in each screen size these must use. you may refer this,

http://developer.android.com/guide/practices/screens_support.html

http://jennift.com/dpical.html

Sagar Thakarar
  • 261
  • 3
  • 20
0

These are different type of resource qualifiers:

  • ldpi, mdpi, hdpi, xhdpi are based on the screen pixel density, and usually used for bitmap drawables.

  • sw320 (actually incorrect, it should be sw320dp) is based on the screen smallest size and is usually used for layout, or dimensions.

They are orthogonal, you could even have layout-sw320dp-hdpi (althought is usually doesn't make sense to make the layout depends on the screen density). See Providing Alternative Resources for a complete list of qualifier types and values and how to mix them.

bwt
  • 17,292
  • 1
  • 42
  • 60