Although we strongly recommend that you design your app so it can adapt to all screen sizes and densities, you still might not want your app to support certain screen configurations. If so, you can limit how much Android can resize your app or even restrict which devices can install it, as described on this page.
Before you restrict your app to certain screens, you should understand all the techniques to support multiple screens and implement them to the best of your ability.
Publish separate APKs for different screens
In case it's unreasonable for you to build a single APK that supports all screen configurations, Google Play allows you to publish multiple APKs for the same app listing. You can use this feature to provide separate APKs that each support a different set of screen configurations (as declared in the manifest file) without creating separate listings in the Google Play Store.
For example, if you want to publish both a handset version and a tablet version of your app, but you're unable to make one APK work for both screen sizes, you can publish two APKs for the same app listing. Depending on each device's screen configuration, Google Play will download the APK that matches each device's screen size.
For more information, see Creating Multiple APKs for Different Screen Sizes.
Declare a maximum aspect ratio
To properly support as many screens as possible, we recommend that you design your app to support a screen aspect ratio of 2.1 (2.1:1) or higher. But if your app cannot adapt to ratios that large, you can declare a maximum ratio, which enables letterboxing for your app's interface when running on an aspect ratio that large (or larger).
To set the maximum aspect ratio for Android 8.0 (API level 26) and higher,
declare the max ratio using
android:MaxAspectRatio in your
The following example shows how to declare a maximum aspect ratio of 2.33 (7:3):
<activity android:maxAspectRatio="2.33"> ... </activity>
<meta-data android:name="android.max_aspect" android:value="2.33" />
Then, if the activity runs on a device (or a portion of the screen) with an aspect ratio that's larger than 2.33, the app does not fill the screen. Instead, the system letterboxes the app, leaving portions of the screen unused so your app displays at its specified maximum aspect ratio (2.33).
If you set a maximum aspect ratio, you must specifiy a value of at least 1.33, except on Android Wear devices, where it must be at least 1.0. If you specify a value less than these minimum values, the system uses the default value for maximum aspect ratio:
- If your app targets Android 8.0 (API level 26) or higher, there is no maximum. Your app uses the native aspect ratio of the device.
- If your app targets Android 7.1 (API level 25) or lower, the default maximum ratio is 16:9 (approximately 1.86).
Most devices do not support a ratio lower than 16:9; some devices support higher ratios than 16:9. In addition, if a device is running in multi-window mode, an app might run in a portion of the screen that is much wider than it is tall.
Note: If you set
android:resizeableActivity to true, your app cannot have
a maximum aspect ratio, regardless of whether you have explicitly specified
one. In such a case, the app uses the device's native aspect ratio.
In Android 7.0 (API level 24) and higher,
android:resizeableActivity defaults to true. You must
set that attribute to false for a maximum aspect ratio that you set to take
Declare a maximum screen size
Even if don't completely optimize your app to support different screen sizes, Android can still stretch most apps to fit larger screens. So it's almost never necessary to declare a maxiumum screen size.
And if you decide to create multiple APKs for different screen sizes, there's no need to limit
an APK to small screens only, because your APK that is optimized for large
screens should have the larger
versionCode, so Google Play always gives that
APK to devices with a large screen.
However, if you're still not satisfied with the way
Android resizes your app for large screens, you can disable resizing beyond
a certain width by specifying the
<supports-screens> manifest tag.
Then, instead of resizing your layout, Android enables screen compatibility
draws your layout as it would on the largest size your app supports, and then
scale up all the pixels to fill the screen.
Restrict your app for tablets or TVs only
You can prevent handset devices from downloading your app by using
<supports-screens> manifest element.
For example, the following declares that only large and xlarge screens should install your app:
<manifest ... > <supports-screens android:smallScreens="false" android:normalScreens="false" android:largeScreens="true" android:xlargeScreens="true"/> ... </manifest>
Restrict your app for specific sizes and densities only
You can define the exact screen sizes and densities your app supports using the
manifest element. But we strongly recommend you avoid using this because any
combination of size and density that you do not specify is considered a
screen configuration with which your app is not compatible. So using
this element makes it easy to block your app from lots of devices that your app
actually can support.
<compatible-screens> element must contain one or more
<screen> elements. Each
specifies a screen configuration with which your app is compatible, using both
<screen> element must include
both attributes to specify an individual screen configuration—if
either attribute is missing, then the element is invalid (external services such
as Google Play will ignore it).
Here's what the manifest entry looks like if your app is compatible with only small and normal screen sizes (and a subset of screen densities):
<manifest ... > <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" /> </compatible-screens> ... <application ... > ... <application> </manifest>
Any size and density combination not explicitly declared here will be restricted from installing the app.