Android如何决定使用哪个布局文件夹?

Android如何决定使用哪个布局文件夹?,android,Android,在我的应用程序中,我有3个不同的布局文件夹: layout layout-large layout-xlarge 我是根据可用的Android设备屏幕(如图所示)来完成这项工作的。所以我认为屏幕尺寸(英寸)是决定使用哪个布局文件夹的唯一因素。但最近对各种7英寸模拟器的测试表明,有时使用布局,有时使用布局大文件夹。那么有人能告诉我使用了哪些其他因素吗?我认为以英寸为单位的尺寸是唯一重要的因素。前一段时间有个问题,有人试图让仿真器从7英寸设备的正确布局文件夹中进行选择,结果有些奇怪。我有一个Gal

在我的应用程序中,我有3个不同的布局文件夹:

layout
layout-large
layout-xlarge

我是根据可用的Android设备屏幕(如图所示)来完成这项工作的。所以我认为屏幕尺寸(英寸)是决定使用哪个布局文件夹的唯一因素。但最近对各种7英寸模拟器的测试表明,有时使用
布局
,有时使用
布局大
文件夹。那么有人能告诉我使用了哪些其他因素吗?

我认为以英寸为单位的尺寸是唯一重要的因素。前一段时间有个问题,有人试图让仿真器从7英寸设备的正确布局文件夹中进行选择,结果有些奇怪。我有一个Galaxy标签,它总是从layout large或layout hdpi获取

编辑:也许我是错的,似乎屏幕类型和像素数也很重要-

* small: Screens based on the space available on a low-density QVGA screen. Considering a portrait HVGA display, this has the same available width but less height—it is 3:4 vs. HVGA's 2:3 aspect ratio. The minimum layout size for this screen configuration is approximately 320x426 dp units. Examples are QVGA low density and VGA high density.
* normal: Screens based on the traditional medium-density HVGA screen. A screen is considered to be normal if it is at least this size (independent of density) and not larger. The minimum layout size for this screen configuration is approximately 320x470 dp units. Examples of such screens a WQVGA low density, HVGA medium density, WVGA high density.
* large: Screens based on the space available on a medium-density VGA screen. Such a screen has significantly more available space in both width and height than an HVGA display. The minimum layout size for this screen configuration is approximately 480x640 dp units. Examples are VGA and WVGA medium density screens.
* xlarge: Screens that are considerably larger than the traditional medium-density HVGA screen. The minimum layout size for this screen configuration is approximately 720x960 dp units. In most cases, devices with extra large screens would be too large to carry in a pocket and would most likely be tablet-style devices. Added in API Level 9.

如果您碰巧有包含多个限定符的文件夹,如layout large mdpi等,您还必须注意优先级顺序。应该会有所帮助。

7英寸安卓平板电脑是
HDPI
large

xlarge
在制造时并不存在,尽管大多数设备的像素密度都在
160左右(
MDPI
),但它们将自己呈现为
HDPI
设备,因为它看起来更好


因此,7英寸平板电脑不能很好地融入资源系统,因为在3.0版本之前,还没有一种真正的方法来适应它们,3.0版本引入了新的屏幕大小限定符。

根据res/layout,它是用于普通屏幕的,是操作系统的默认文件夹。

+1谢谢,这解释了一些问题。你从哪里得到屏幕的描述?我也想读一读,它在我答案底部链接的页面上的一个表格里。