Android: Large 和 Xlarge 布局之间的区别?
Android: Difference Between Large and Xlarge Layout?
我正在创建一个应用程序。我想让这个应用程序支持平板电脑,所以我在我的资源中创建了一个文件夹:res/layout-xlarge/my_layout.xml
。但是,当我 运行 我的应用程序在平板电脑(定义为 7" 或以上)上时,布局不是来自 layout-xlarge
文件夹,而是来自 layout
文件夹。
然后我发现我也可以使用 layout-large
布局。我还没有尝试过,但我会的。
我想知道 layout
文件、layout-large
文件和 layout-xlarge
文件之间有什么区别。哪一个最适合用于平板电脑布局?
谢谢!
来自Android documentation - Supporting Multiple Screens:
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
如您所见,使用哪一个取决于您要使用的设备的尺寸。您可能希望构建您的应用程序,使其支持尽可能多的设备。
在 Android 中,我们需要为具有不同分辨率的布局维护不同的文件夹,其背后原因是应用程序将在其上执行的 Android 设备的使用或分辨率。
小屏幕资源。
normal 正常尺寸屏幕的资源。 (这是基线大小。)
大屏幕资源。
超大尺寸屏幕的 xlarge 资源。
Android OS select具体布局自行查看兼容设备及其分辨率。
所以,最好创建文件夹以支持多屏幕
我正在创建一个应用程序。我想让这个应用程序支持平板电脑,所以我在我的资源中创建了一个文件夹:res/layout-xlarge/my_layout.xml
。但是,当我 运行 我的应用程序在平板电脑(定义为 7" 或以上)上时,布局不是来自 layout-xlarge
文件夹,而是来自 layout
文件夹。
然后我发现我也可以使用 layout-large
布局。我还没有尝试过,但我会的。
我想知道 layout
文件、layout-large
文件和 layout-xlarge
文件之间有什么区别。哪一个最适合用于平板电脑布局?
谢谢!
来自Android documentation - Supporting Multiple Screens:
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
如您所见,使用哪一个取决于您要使用的设备的尺寸。您可能希望构建您的应用程序,使其支持尽可能多的设备。
在 Android 中,我们需要为具有不同分辨率的布局维护不同的文件夹,其背后原因是应用程序将在其上执行的 Android 设备的使用或分辨率。
小屏幕资源。
normal 正常尺寸屏幕的资源。 (这是基线大小。)
大屏幕资源。
超大尺寸屏幕的 xlarge 资源。
Android OS select具体布局自行查看兼容设备及其分辨率。
所以,最好创建文件夹以支持多屏幕