如何下载分辨率为600 x 1024(7“平板电脑)或800 x 1280(平板电脑10”)并限制其他分辨率设备的应用程序?

时间:2013-12-03 10:10:20

标签: android

我想只允许那些设备下载我的应用程序,其分辨率为600 x 1024(7“平板电脑)和800 x 1280(适用于10”平板电脑)。我该怎么做?我做了一些RnD并得到了一些我可以从manifest.xml文件中限制它的东西。但是我无法从两个选项中弄清楚我的解决方案是什么?

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

2)<compatible-screens> <screen android:screenDensity="hdpi" android:screenSize="normal"/> <screen android:screenDensity="mdpi" android:screenSize="xlarge"/> </compatible-screens>

我应该使用哪一个只允许上述分辨率设备并限制其他设备下载我的应用程序?

谢谢,

1 个答案:

答案 0 :(得分:1)

你必须首先计算屏幕尺寸,如

<manifest ... >
    <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" />
    </compatible-screens>
    ...
    <application ... >
        ...
    <application>
</manifest>

了解更多信息,请参阅此链接http://developer.android.com/guide/practices/screens-distribution.html