android - sw720dp 和 xlarge 布局文件夹区别

标签 android android-layout layout

layout-xlargelayout-sw720dp 文件夹下有哪些平板电脑?

例如 8"- 10"位于 layout-xlarge 文件夹下。它来自文档:

enter image description here

但是 layout-sw720dp 呢?

我知道如果我没有 layout-xlarge 文件夹,android 会将 10"平板电脑导航到 layout-sw720dp,但是 8"- 9"平板电脑呢?

Android 会选择layout 还是layout-sw720dp 文件夹?

最佳答案

layout-sw720dp表示最小宽度为 720dp 的设备。具体来说,设备的 smallestWidth 是屏幕可用高度和宽度中最短的。

From Here

smallestWidth

Examples:sw320dp, sw600dp, sw720dp etc. The fundamental size of a screen, as indicated by the shortest dimension of the available screen area. Specifically, the device's smallestWidth is the shortest of the screen's available height and width (you may also think of it as the "smallest possible width" for the screen). You can use this qualifier to ensure that, regardless of the screen's current orientation, your application has at least dps of width available for its UI.

但是,如果您同时使用 layout-xlargelayout-sw720dp在一个应用程序中,符合这两个条件的设备将始终取自 layout-sw720dp .这是因为 sw<???>dp 的优先级更高预选赛。这在上面链接的文档中有明确规定。如果您为任何资源提供了多种限定符类型,Android 将按照每种类型的优先顺序搜索符合条件的文件夹。

来自文档

Android supports several configuration qualifiers and you can add multiple qualifiers to one directory name, by separating each qualifier with a dash.
Table lists the valid configuration qualifiers, in order of precedence—if you use multiple qualifiers for a resource directory, you must add them to the directory name in the order they are listed in the table.

关于android - sw720dp 和 xlarge 布局文件夹区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39701939/

相关文章:

css - 是否可以根据内容设置比例网格列?

android - 删除返回堆栈中的多个 fragment

android - 如何在 SeekBar 中隐藏/显示缩略图

Android 文件系统和可用空间困惑

android - 从 Activity 返回时没有当前的 openGL 上下文?

滚动时 Android ListView 生涩

ruby-on-rails-3 - 如何为类或模块中的所有 Controller 设置特定布局。 (导轨 3)

具有背景、源和文本的 Android ImageButton

android - 约束布局垂直和水平对齐两个 View

wpf - 防止网格中的控件更改其列宽