【问题标题】:Screen limitations in 2.22.2 中的屏幕限制
【发布时间】:2011-10-25 16:03:15
【问题描述】:

我需要将我的应用程序限制为只能在小、中和大屏幕上运行,但不能在 xlarge 上运行。由于构建是在 2.2 上,因此我无法将其写入清单中。

【问题讨论】:

标签: android android-manifest manifest


【解决方案1】:

使用<compatible-screens>,如:

<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" />
    <!-- all large size screens -->
    <screen android:screenSize="large" android:screenDensity="ldpi" />
    <screen android:screenSize="large" android:screenDensity="mdpi" />
    <screen android:screenSize="large" android:screenDensity="hdpi" />
    <screen android:screenSize="large" android:screenDensity="xhdpi" />
</compatible-screens>

我无法在清单中写它,因为构建是在 2.2 上。

你表现得好像你有一个选择。你不。将项目的构建目标更改为 API 级别 9。

【讨论】:

    【解决方案2】:

    您无需在清单文件中执行任何操作。 xlarge 标签是在 Android 2.3 中引入的,因此与您的情况无关。

    更新 如果你想确保 xlarge 设备不能使用它,你应该把它放在你的应用程序清单文件中,并将目标 API 更改为级别 9(Android 2.3,其中引入了标签)和最低 SDK 级别。更低,即 Android 2.2 为 8。

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

    【讨论】:

    • 我这里有很多平板电脑,他们不这么认为:(他们似乎下载、安装和运行应用程序都很好。
    • 哦,我想我明白你的意思了。请参考我的更新答案。
    • @Michell Bak:您的 &lt;support-screens&gt; 表示该应用适用于 xlarge,这与 OP 的要求相反。
    • 对不起,我只是从自己的应用程序中复制的,忘记更改了。谢谢:)
    猜你喜欢
    • 2010-09-06
    • 1970-01-01
    • 2011-03-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多