简体   繁体   English

Android支持多种屏幕尺寸

[英]Android supporting multiple screen sizes

I have a bit confusion about supporting different screen sizes. 我对支持不同的屏幕尺寸有些困惑。
In android manual it's written that layout-large .. layout-xlarge ..etc are deprecated in android 3.2+, and we should use instead layout-swXXXdp .. 在android手册中写到在android 3.2+中不推荐使用layout-large .. layout-xlarge ..etc,我们应该改用layout-swXXXdp ..

if I want to write an app that supports android API level +8, do i have to make two folders, one folder layout-large for APIs lower that 11, and another folder layout-600dp for APIs level 11 and above ? 如果我要编写一个支持android API级别+8的应用程序,我是否必须制作两个文件夹,一个用于API低于11的大文件夹布局,一个用于API 11或更高级别的600dp文件夹?

Put the pre-11 layouts in res/layout and put the 11+ versions of the layouts in res/layout-v11. 将11之前的版式放入res / layout,并将11+版本的版式放入res / layout-v11。 Following the guidelines of the Android documentation. 遵循Android文档的准则。

According to this document 根据这份文件

The smallest-width qualifier is available only on Android 3.2 and above. 最小宽度的限定符仅在Android 3.2及更高版本上可用。 Therefore, you should also still use the abstract size bins (small, normal, large and xlarge) to be compatible with earlier versions. 因此,您还应该仍然使用抽象大小容器(小,标准,大和xlarge)以与早期版本兼容。 For example, if you want to design your UI so that it shows a single-pane UI on phones but a multi-pane UI on 7" tablets, TVs and other large devices, you'd have to supply these files: 例如,如果要设计UI,使其在电话上显示单窗格UI,而在7英寸平板电脑,电视和其他大型设备上显示多窗格UI,则必须提供以下文件:

res/layout/main.xml: single-pane layout res/layout-large: multi-pane layout res/layout-sw600dp: multi-pane layout res / layout / main.xml:单窗格布局res / layout-large:多窗格布局res / layout-sw600dp:多窗格布局

I don't think layout-large is deprecated. 我认为不建议过大的版面。 layout-sw600dp would work for API level greater than 11. On top of that, there are only a few devices which falls under sw600dp and are lower than api level 8. layout-sw600dp适用于大于11的API级别。最重要的是,只有少数设备属于sw600dp且低于api级别8。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM