I need to limit my app to only run on screen small, medium and large screens but not xlarge. I can't write it in the manifest since the build is on 2.2.
Asked
Active
Viewed 554 times
0
-
http://stackoverflow.com/questions/6984488/cant-use-androidxlargescreens-true – cornbread ninja Oct 25 '11 at 16:08
2 Answers
3
Use <compatible-screens>
, such as:
<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>
I can't write it in the manifest since the build is on 2.2.
You act as though you have a choice. You do not. Change your project's build target to API Level 9.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491
1
You won't need to do anything in the manifest file. The xlarge
tag was introduced in Android 2.3, so it won't be relevant in your case.
Updated If you want to make sure that xlarge devices can't use it, you should put this in your application manifest file and change the target API to level 9 (Android 2.3, in which the tag was introduced) and the minimum SDK level to something lower, i.e. 8 for Android 2.2.
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:xlargeScreens="false" />

Michell Bak
- 13,182
- 11
- 64
- 121
-
I've got a bunch of tablets here who think otherwise :( They seem to download, install and run the app just fine. – OrhanC1 Oct 25 '11 at 16:13
-
Oh, I think I know what you mean then. Please refer to my updated answer. – Michell Bak Oct 25 '11 at 16:18
-
1@Michell Bak: Your `
` says that the app *only* works on `xlarge`, which is the inverse of what the OP requests. – CommonsWare Oct 25 '11 at 17:37 -
1Sorry, I just copied it from an app of my own, and forgot to change it. Thanks :) – Michell Bak Oct 25 '11 at 17:39