简体   繁体   中英

How to support phones up to 4.0, excluding tablets?

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!

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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