Reputation: 115
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?
Upvotes: 2
Views: 2128
Reputation: 17755
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.
Upvotes: 1
Reputation: 2609
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.
Upvotes: 2
Reputation: 271
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
Upvotes: 0