其他分享
首页 > 其他分享> > 如何在Android清单文件中定位xxxhdpi设备?

如何在Android清单文件中定位xxxhdpi设备?

作者:互联网

根据Google文档(http://developer.android.com/guide/topics/manifest/compatible-screens-element.html#compatible-screens),我正在使用< compatibile屏幕>标签以定位到我的应用的特定屏幕(我仅尝试定位手机).这是我的清单:

<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" />
    <!-- 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="normal" android:screenDensity="420" />
    <screen android:screenSize="normal" android:screenDensity="480" />
    <screen android:screenSize="normal" android:screenDensity="560" />

</compatible-screens>

但是,这样做的话,某些设备在Google Play商店中被列为不兼容,例如三星Galaxy S6,nexus 5x和nexus 6P.似乎不包括所有具有很高dpi的设备(xxxdpi).如何包括这些电话?

解决方法:

使用可以以这种方式在清单文件中定义

<supports-screens android:resizeable=["true"| "false"]
                  android:smallScreens=["true" | "false"]
                  android:normalScreens=["true" | "false"]
                  android:largeScreens=["true" | "false"]
                  android:xlargeScreens=["true" | "false"]
                  android:anyDensity=["true" | "false"]
                  android:requiresSmallestWidthDp="integer"
                  android:compatibleWidthLimitDp="integer"
                  android:largestWidthLimitDp="integer"/>

有关更多详细信息,请点击此链接
http://developer.android.com/guide/topics/manifest/supports-screens-element.html

标签:hdpi,android-manifest,android
来源: https://codeday.me/bug/20191119/2035039.html