在我的应用程序中,我有3个不同的布局文件夹:
layout
layout-large
layout-xlarge
我根据可用的Android设备屏幕执行此操作,描述为here。所以我认为以英寸为单位的屏幕大小是唯一用来决定使用哪个布局文件夹的东西。但最近使用各种7英寸仿真器进行的测试显示,有时会使用layout
,有时使用layout-large
文件夹。那么有谁可以告诉我使用了哪些其他因素?
答案 0 :(得分:3)
7英寸Android平板电脑为HDPI
和large
。
xlarge
在制作时并不存在,虽然大多数像素密度都在160
(MDPI
)左右,但它们表现为HDPI
个设备因为它看起来更好。
所以7inch平板电脑并不适合资源系统,因为在引入新的屏幕大小限定符的3.0之前,没有真正适合它们的方法。
答案 1 :(得分:1)
我认为以英寸为单位的尺寸是唯一重要的事情。在这里有一个问题,有人在尝试让模拟器从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等,您还必须注意优先顺序。 this page应该提供帮助。
答案 2 :(得分:0)
根据Google's android screen support guide res / layout用于普通屏幕,是操作系统所在的默认文件夹。