Skip to content

Most visited

Recently visited

navigation

Declare Restricted Screen Support

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 <activity> tag. The following example shows how to declare a maximum aspect ratio of 2.33 (7:3):

<activity android:maxAspectRatio="2.33">
 ...
</activity>

For Android 7.1 and lower, add a <meta-data> element named android.max_aspect in the <application> element, as follows:

<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:

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 effect.

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 largestWidthLimitDp attribute in the <supports-screens> manifest tag. Then, instead of resizing your layout, Android enables screen compatibility mode, which 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 the <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 <compatible-screens> 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.

The <compatible-screens> element must contain one or more <screen> elements. Each <screen> element specifies a screen configuration with which your app is compatible, using both the android:screenSize and android:screenDensity attributes. Each <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.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)