简体   繁体   English

过滤掉Google Play上的所有平板电脑(无屏幕兼容模式)

[英]filter out all tablets on google-play ( no screen compatibility mode)

regarding to the documentation ( http://developer.android.com/guide/practices/screens-distribution.html#FilteringHandsetApps ) you should do: 关于文档( http://developer.android.com/guide/practices/screens-distribution.html#FilteringHandsetApps ),您应该执行以下操作:

<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>

but this also filters out handsets with eg xxhdpi - unfortunately you cannot add xxhdpi as it is not available as a value: http://developer.android.com/guide/topics/manifest/compatible-screens-element.html supports-screens is also no option as: 但这也会用xxhdpi过滤掉手机-不幸的是,您无法添加xxhdpi,因为它不能作为值使用: http : //developer.android.com/guide/topics/manifest/compatible-screens-element.html support-screens也没有选择,因为:

Caution: If you use the element for the reverse scenario (when your application is not compatible with larger screens) and set the larger screen size attributes to "false", then external services such as Google Play do not apply filtering. 注意:如果您将元素用于相反的情况(当您的应用程序与大屏幕不兼容时)并将大屏幕尺寸属性设置为“ false”,则外部服务(例如Google Play)将不应用过滤。 Your application will still be available to larger screens, but when it runs, it will not resize to fit the screen. 您的应用程序仍可用于较大的屏幕,但是在运行时,将无法调整大小以适合屏幕。 Instead, the system will emulate a handset screen size (about 320dp x 480dp; see Screen Compatibility Mode for more information). 取而代之的是,系统将模拟手机的屏幕尺寸(大约320dp x 480dp;有关更多信息,请参见屏幕兼容模式)。 If you want to prevent your application from being downloaded on larger screens, use , as discussed in the previous section about Declaring an App is Only for Handsets. 如果要防止在较大的屏幕上下载应用程序,请使用,如上一节“声明应用程序仅适用于手机”中所述。

another option is to filter for telephony feature - but there are some tablets that have telephony. 另一个选项是过滤电话功能-但是有些平板电脑具有电话功能。 Is there any way to do this right? 有什么办法可以做到这一点吗?

This should work: 这应该工作:

<compatible-screens>
    <!-- all small size screens -->
    ...
    <!-- support for xxhdpi densities -->
    <screen android:screenSize="small" android:screenDensity="480" />
    <!-- all normal size screens -->
    ...
    <!-- support for xxhdpi densities -->
    <screen android:screenSize="normal" android:screenDensity="480" />
</compatible-screens>

As per the documentation itself , you simply put the raw int value for xxhdpi screens: 根据文档本身 ,您只需为xxhdpi屏幕输入原始int值:

Note: This attribute currently does not accept xxhdpi as a valid value, but you can instead specify 480 as the value, which is the approximate threshold for xhdpi screens. 注意:此属性当前不接受xxhdpi作为有效值,但是您可以将480指定为该值,这是xhdpi屏幕的近似阈值。

你尝试过吗?

<supports-screens android:largestWidthLimitDp="500"/>

I would instead use this configuration so you can include more phones: 相反,我将使用此配置,以便您可以包括更多电话:

<compatible-screens>
    <!-- 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="280" />
    <screen android:screenSize="small" android:screenDensity="360" />
    <screen android:screenSize="small" android:screenDensity="420" />
    <screen android:screenSize="small" android:screenDensity="480" />
    <screen android:screenSize="small" android:screenDensity="560" />
    <screen android:screenSize="small" android:screenDensity="640" />
    <!-- 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="280" />
    <screen android:screenSize="normal" android:screenDensity="360" />
    <screen android:screenSize="normal" android:screenDensity="420" />
    <screen android:screenSize="normal" android:screenDensity="560" />
    <screen android:screenSize="normal" android:screenDensity="640" />
</compatible-screens>

This way you support all the possible densities mentioned in http://developer.android.com/guide/topics/manifest/compatible-screens-element.html and also add 640 if you want to support some of the newest phones (such as Samsung Galaxy S6 for example) 这样,您就可以支持http://developer.android.com/guide/topics/manifest/compatible-screens-element.html中提到的所有可能的密度,并且如果要支持某些最新的电话(例如,以三星Galaxy S6为例)

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

Its help for you.its filter tablets only like 7 and 10 inches.try with this once 它对您有帮助。它的过滤片只有7英寸和10英寸,请尝试一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM