适用于 Play 商店的应用屏幕密度支持



我想在Play商店中部署我的应用程序,用于各种密度的小型和普通手机。<screen>元素的android:screenDensity属性没有xxhdpi密度,xxxhdpi密度作为预定义值。我是否应该使用值 480560 作为相应的缺失密度?

或者我可以用这个吗?

<supports-screens android:smallScreens="true"
                  android:normalScreens="true"
                  android:largeScreens="false"
                  android:xlargeScreens="false"/>

这是否涵盖了所选屏幕尺寸的所有密度?

<supports-screens> 标记中,将 android:largeScreensandroid:xlargeScreens 的值设置为 false 不会使你的应用不适用于这些屏幕尺寸。它只会在这些屏幕尺寸上为您的应用启用屏幕兼容模式。

来自 Android 开发者文档:

安卓:大屏幕

指示应用程序是否支持更大的屏幕外形规格。大屏幕被定义为比"普通"手机屏幕大得多的屏幕,因此可能需要应用程序部分特别小心才能充分利用它,尽管它可能依赖于系统调整大小来填充屏幕。 此功能的默认值实际上因某些版本而异,因此最好始终显式声明此属性。请注意,将其设置为"false"通常会启用屏幕兼容模式。

安卓:大屏幕

指示应用程序是否支持超大屏幕外形规格。超大屏幕被定义为明显大于"大"屏幕的屏幕,例如平板电脑(或更大的屏幕),并且可能需要应用程序特别注意才能充分利用它,尽管它可能依赖于系统调整大小来填充屏幕。 此功能的默认值实际上因某些版本而异,因此最好始终显式声明此属性。请注意,将其设置为"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 开发者文档的这篇文章,其中介绍了如何使您的应用仅供手机使用。

我会选择第二个选项;指定支持的屏幕,然后可能添加anyDensity="true":

<supports-screens android:smallScreens="true"
                  android:normalScreens="true"
                  android:largeScreens="false"
                  android:xlargeScreens="false"
                  android:anyDensity="true"/>

没有必要设置xxhdpixxxhdpi。然后始终使用模拟器在不同的屏幕尺寸和密度上测试您的应用。

最新更新