According to the note written in this documentation (DeclaringTabletLayouts), the old groups was deprecated (small, normal, large, and xlarge), which is why we have to migrate to the new technique defined in Android 3.2.
Note: Beginning with Android 3.2 (API level 13), these size groups are deprecated in favor of a new technique for managing screen sizes based on the available screen width. If you're developing for Android 3.2 and greater, see Declaring Tablet Layouts for Android 3.2 for more information.
How do we make different layouts for small vs normal vs large screens with the new technique? I tried it and didn't find a solution, I want to set a different layout for each one, and the note said that is deprecated.
Old way classification :
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
New way :
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
res/layout-sw320dp/main_activity.xml # For handsets (smaller than 600dp available width)
res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)
It is well explained in the documentation that you can use it by creating layout.xml
in values file, and creating aliases to point to alternative layouts. You can create values-large,values-sw-600, etc. and point to the layout alias you want to choose for that particular type.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="layout" name="login">@layout/login_large
</item>
</resources>
Refer to http://developer.android.com/training/multiscreen/screensizes.html, as it explains well how to develop for multiple screens in the best way.
来源:https://stackoverflow.com/questions/12316549/screen-support-in-android-3-2-api-level-13