How to support phones up to 4.0, excluding tablets?

丶灬走出姿态 提交于 2019-12-22 14:47:15

问题


There is an easy way to provide compatibility for phones up to 4.0, but excluding tablets?

For example, can I:

<uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="14" />

And then set:

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

This config filter the tablets from market?

Many thanks for the help!


回答1:


First of all, let me be very clear in pointing out that this is not recommended. Google wants developers to create apps that work on pretty much all devices, but if you insist, it's kind of possible to do.

What you'll need to do first is define what a tablet is. My definition of a tablet - in Android terms - is a device that has a screen size of large or x-large. Devices with a normal or small screen are usually mobile phones. There are some exceptions, though. You can use this illustration as a reference:

Anyway, once you're happy with your definition of a tablet, you can just set the supports-screen tag in the manifest to the following:

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

Also, you want to target the latest API level in your manifest (which was level 15 as of this post):

<uses-sdk
        android:minSdkVersion="4"
        android:targetSdkVersion="15" />

Again - this is NOT recommended. You should try to work on a layout that will also work on tablets. A tablet optimized layout would be even better, but at least make it work on tablets.




回答2:


In addition to what you already outlined when you publish the device you can select the specific devices that you do not want your app to be available on. The option is near the bottom under "Compatible Devices" This will take out any guesswork.



来源:https://stackoverflow.com/questions/9605715/how-to-support-phones-up-to-4-0-excluding-tablets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!