As I understand layout-small
, layout-normal
, layout-large
are deprecated and the recommended way of creating layout for a devices' set is to use sw. For example layout-sw320
is for devices which have one of it's side with value >= 320dp. But "small" and "normal" devices have the same sw.
So the question is how properly distinguish "small" and "normal" devices with sw qualifier? Is it possible? Do I need to fall back to old style ?
The new device dimension classifiers aim to support based on the smallest width of the device; not so much the height. If your application is relying on the height, you will have to support the orientations separately or disable them using the screenOrientation
property in the AndroidManifest.xml
<activity>
attribute.
For example, using screenOrientation="sensorPortrait|portrait"
allows you to rely on the swXXX
only, but if you support all screen orientations you can support them with:
layout-w320-port
, which is called for small
and large
screens in the old specification when in portrait layout-w320-h426-port
and layout-w320-h470-port
when you want to differentiate between the two in portrait mode specifically. layout-w426-land
for the previous small
screen, when in landscape orientation layout-w470-land
for the previous large
screen, when in landscape orientation Hope this helps!
in manifest -
<supports-screens android:resizeable=["true"| "false"]
android:smallScreens=["true" | "false"]
android:normalScreens=["true" | "false"]
android:largeScreens=["true" | "false"]
android:xlargeScreens=["true" | "false"]
android:anyDensity=["true" | "false"]
android:requiresSmallestWidthDp="integer"
android:compatibleWidthLimitDp="integer"
android:largestWidthLimitDp="integer"/>
check the link - http://developer.android.com/guide/topics/manifest/supports-screens-element.html and http://developer.android.com/guide/practices/screens_support.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.