Android资源限定符-sw#dp与-w#dp [英] Android Resource Qualifiers -sw#dp vs -w#dp
问题描述
说我正在为屏幕尺寸等于或大于600dp的设备开发不同的布局.
我想使用android 3.2后的资源限定词.我创建了一个名为layout-sw600dp
的文件夹并将其放置在此处,但同时我可以创建一个名为layout-w600dp
的文件夹并将该布局xml文件放置在其中.
我试图弄清楚-sw600dp
和-w600dp
有什么区别?毕竟,它们都打算对宽度> = 600dp的设备使用布局.
Say I'm developing a different layout for devices with screen size equal to or greater than 600dp.
I want to use the post android 3.2 resource qualifiers. I created a folder named layout-sw600dp
and put my layout there, but at the same time I could have created a folder named layout-w600dp
and put the layout xml file there.
I'm trying to figure out what is the difference between -sw600dp
and -w600dp
? After all they are both meant to use the layout for device of width >= 600dp.
推荐答案
sw
为"最小宽度".旋转设备不会改变.
sw
is "smallest width". It doesn't change if the device is rotated.
w
可用宽度(即 current ).
请参见提供替代资源:
smallestWidth-
sw<N>dp
-MinimumWidth是设备的固定屏幕尺寸特征; 当屏幕的 方向改变.
smallestWidth -
sw<N>dp
- The smallestWidth is a fixed screen size characteristic of the device; the device's smallestWidth does not change when the screen's orientation changes.
可用宽度-w<N>dp
-当横向和纵向之间的方向改变以匹配时,此配置值将更改
当前的实际宽度.
Available width - w<N>dp
- This configuration value will change when the orientation changes between landscape and portrait to match
the current actual width.
示例.假设您有一台600dp x 400dp的设备.
Example. Say that you have a device that is 600dp x 400dp.
- 如果您拥有w600dp资源,它将以横向方式使用,而不能以纵向方式使用.
- 如果您拥有sw600dp资源,则不会将其用于任何方向(最小为400).
这篇关于Android资源限定符-sw#dp与-w#dp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!