[英]How to create layout for “small” devices with sw qualifier?
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. 据我了解,不建议使用
layout-small
, layout-normal
, layout-large
,建议为设备集创建布局的方法是使用sw。 For example layout-sw320
is for devices which have one of it's side with value >= 320dp. 例如,
layout-sw320
适用于一侧值大于等于320dp的设备。 But "small" and "normal" devices have the same sw. 但是“小型”和“普通”设备具有相同的sw。
So the question is how properly distinguish "small" and "normal" devices with sw qualifier? 因此,问题是如何用sw限定词正确区分“小型”和“普通”设备? 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. 如果您的应用程序依赖于高度,则必须单独支持方向,或者使用
AndroidManifest.xml
<activity>
属性中的screenOrientation
属性禁用它们。
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: 例如,使用
screenOrientation="sensorPortrait|portrait"
允许您依赖swXXX
,但如果支持所有屏幕方向,则可以通过以下方式支持它们:
layout-w320-port
, which is called for small
and large
screens in the old specification when in portrait layout-w320-port
,在纵向模式下,纵向和纵向都需要使用small
屏幕和 large
屏幕 layout-w320-h426-port
and layout-w320-h470-port
when you want to differentiate between the two in portrait mode specifically. layout-w320-h426-port
和layout-w320-h470-port
。 layout-w426-land
for the previous small
screen, when in landscape orientation small
屏幕的layout-w426-land
layout-w470-land
for the previous large
screen, when in landscape orientation large
屏幕的layout-w470-land
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 检查链接-http://developer.android.com/guide/topics/manifest/supports-screens-element.html和http://developer.android.com/guide/practices/screens_support.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.