可以在所有屏幕尺寸上使用吗? [英] Will this work on all screen sizes?
问题描述
我最近在针对所有屏幕尺寸优化我的应用程序方面进行了大量研究.我已经为每种布局创建了9种,以适合各种尺寸.
I've been doing lots of research lately on optimizing my app for all screen sizes. I've created 9 of every layout in order to fit every size.
不用担心layout
目录中的其他两种布局,以后我会再添加8种
Don't worry about those other two layouts that are just in the layout
directory, I will make 8 more of those later
(Android视图)
(Android view)
有些文章说有更多的版式,但是什么呢?我想念什么吗? 我是否正确执行了此操作?
Some articles say to have more layouts, but of what? Am I missing something? Did I do this correctly?
我对自己的屏幕尺寸有些怀疑,因为互联网上有很多人针对不同设备定位的方式不同,这是正确的吗?
I have some doubt about my screen sizes, as lots of people on the internet have different ways of targeting different devices, is this correct?
<compatible-screens>
<screen
android:screenDensity="ldpi"
android:screenSize="small" />
<screen
android:screenDensity="mdpi"
android:screenSize="normal" />
<screen
android:screenDensity="xhdpi"
android:screenSize="large" />
<screen
android:screenDensity="xhdpi"
android:screenSize="xlarge" />
</compatible-screens>
我需要添加更多兼容的屏幕吗?因为其他文件还有很多.我的应用程序会显示在平板电脑等所有设备上吗?
Do I need to add more compatible screens? Because other documents have a lot more. Will my app show up on all devices, like tablets?
我想念一些东西以便针对平板电脑和手机等所有设备进行优化吗?我是否必须在清单中创建任何新的布局或添加更多兼容的屏幕权限?
推荐答案
使用此
<supports-screens
android:anyDensity="true"
android:xlargeScreens="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true" />
如果应用程序正确调整大小,则它支持"给定的屏幕大小 填充整个屏幕.系统应用的正常大小调整 适用于大多数应用程序,您无需做任何额外的工作即可 使您的应用程序在比手持设备更大的屏幕上工作. 但是,优化应用程序的UI通常很重要 提供替代的布局资源,以适应不同的屏幕尺寸. 例如,您可能想在以下情况下修改活动的布局: 与在手持设备上运行相比,它在平板电脑上运行.
An application "supports" a given screen size if it resizes properly to fill the entire screen. Normal resizing applied by the system works well for most applications and you don't have to do any extra work to make your application work on screens larger than a handset device. However, it's often important that you optimize your application's UI for different screen sizes by providing alternative layout resources. For instance, you might want to modify the layout of an activity when it is on a tablet compared to when running on a handset device.
请阅读有关 声明对平板电脑屏幕的支持 & 支持屏幕 .希望对您有帮助.
Please read official Document's about Declare Support for Tablet Screens & supports-screens . I hope it will helps you .
<compatible-screens>
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<!-- all large size screens -->
<screen android:screenSize="large" android:screenDensity="mdpi" />
<screen android:screenSize="large" android:screenDensity="hdpi" />
<screen android:screenSize="large" android:screenDensity="xhdpi" />
<!-- all xlarge size screens -->
<screen android:screenSize="xlarge" android:screenDensity="mdpi" />
<screen android:screenSize="xlarge" android:screenDensity="hdpi" />
<screen android:screenSize="xlarge" android:screenDensity="xhdpi" />
Courtesy Goes to Optimizing Android manifest file for largest number of supported devices
这篇关于可以在所有屏幕尺寸上使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!