【发布时间】:2011-10-25 16:03:15
【问题描述】:
我需要将我的应用程序限制为只能在小、中和大屏幕上运行,但不能在 xlarge 上运行。由于构建是在 2.2 上,因此我无法将其写入清单中。
【问题讨论】:
标签: android android-manifest manifest
我需要将我的应用程序限制为只能在小、中和大屏幕上运行,但不能在 xlarge 上运行。由于构建是在 2.2 上,因此我无法将其写入清单中。
【问题讨论】:
标签: android android-manifest manifest
使用<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。
【讨论】:
您无需在清单文件中执行任何操作。 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" />
【讨论】:
<support-screens> 表示该应用仅适用于 xlarge,这与 OP 的要求相反。