Play商店的屏幕密度支持
我想在Play商店中部署我的应用程序,以获取所有密度的小型和普通手机。 <screen>
元素的android:screenDensity
属性不具有xxhdpi
和xxxhdpi
密度作为预定义值。 我是否应该使用值480
和560
来查找相应的密度?Play商店的屏幕密度支持
或者我可以使用它?
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="false"
android:xlargeScreens="false"/>
这是否覆盖了所选屏幕尺寸的所有密度?
我会去第二个选项;指定支持的屏幕,然后可能添加anyDensity =“真”:
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="false"
android:xlargeScreens="false"
android:anyDensity="true"/>
它不应该是必要设置xxhdpi
和xxxhdpi
。 然后始终使用模拟器在不同的屏幕尺寸和密度下测试您的应用。
在<supports-screens>
标记中,将android:largeScreens
和android:xlargeScreens
的值设置为false将不会使您的应用不适用于这些屏幕尺寸。它只会在这些屏幕尺寸上为您的应用启用屏幕兼容模式。
从Android开发doc:
机器人:largeScreens
指示应用程序是否支持更大的屏幕形式因子。大屏幕被定义为比“普通”手机屏幕大得多的屏幕,并且因此可能需要对应用程序的一部分进行特别的关注以充分利用它,尽管它可能依赖于系统调整大小以填充屏幕。 实际上,它的默认值在一些版本中有所不同,所以最好是在任何时候都显式声明该属性。请注意,将其设置为“false”通常会启用屏幕兼容模式。
安卓xlargeScreens
表示应用程序是否支持超大屏幕的外形尺寸。 xlarge屏幕被定义为比“大”屏幕(如平板电脑(或更大的屏幕))大得多的屏幕,并且可能需要特别注意应用程序的部分以充分利用它,尽管它可能依赖于调整大小由系统填充屏幕。 实际上,它的默认值在一些版本中有所不同,所以最好是在任何时候都显式声明该属性。请注意,将其设置为“false”通常会启用屏幕兼容模式。
如果你想只对手机的使用你的应用程序,以下内容添加到您的清单:
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<screen android:screenSize="small" android:screenDensity="480" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
<screen android:screenSize="small" android:screenDensity="480" />
</compatible-screens>
与android:screenDensity="480"
的条目是支持xxhdpi桶。
查看Android Developer文档中的this article,其中介绍了如何让您的应用仅适用于手机。