简体   繁体   English

如何支持不超过4.0的手机(不包括平板电脑)?

[英]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? 有一种简便的方法可以为4.0以下的手机提供兼容性,但不包括平板电脑吗?

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. Google希望开发人员创建几乎可以在所有设备上运行的应用程序,但是如果您坚持要这样做,那可行的。

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 . 我对平板电脑的定义(用Android术语来说)是一种具有large屏幕或x-large屏幕的设备。 Devices with a normal or small screen are usually mobile phones. 具有normalsmall屏幕的设备通常是手机。 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-screen标签设置为以下内容:

<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): 此外,您还希望定位清单中的最新API级别(在本文中,该级别为15):

<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. 该选项位于“兼容设备”下方的底部附近。这将消除所有猜测。

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

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