如何支持手机高达4.0,但不包括平板电脑? [英] How to support phones up to 4.0, excluding tablets?

查看:115
本文介绍了如何支持手机高达4.0,但不包括平板电脑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个简单的方法,为手机高达4.0的兼容性,但不包括平板电脑?

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

例如,我可以:

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

然后设置:

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

您的帮助非常感谢!

推荐答案

首先,让我在指出很清楚,这是不推荐。谷歌希望开发人员能够创建在pretty太多的所有设备正常工作的应用程序,但如果你坚持,它的样的的可能这样做。

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.

什么你需要做的首先是定义平板电脑是什么。我的平板电脑的定义 - 在Android的方面 - 是有一个屏幕大小的设备 X-大 。以正常屏幕的设备通常是手机。也有一些例外,虽然。您可以使用此图作为参考:

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

此外,要针对你的清单中的最新的API级别(这是因为这个职位的15级):

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.

这篇关于如何支持手机高达4.0,但不包括平板电脑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆