[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# App orientation, aspect ratio, and resizability\n\nAndroid apps run on devices of all kinds: phones, tablets, foldables,\nChromebooks, cars, TVs, and even XR. To adapt to this varied environment, your\napp should support all device form factors and display sizes.\n\nAndroid 16 (API level 36) enables apps to adapt to different form factors and\ndisplay sizes by overriding app restrictions for screen orientation, aspect\nratio, and resizability. The overrides apply to devices with smallest width \\\u003e=\n600dp which defines the following:\n\n- Tablets\n- Inner displays of large screen foldables\n- Desktop windowing (on all form factors)\n\nApps that target API level 36 are resizable and able to enter multi‑window\nmode (equivalent to [`resizeableActivity=\"true\"`](/guide/topics/manifest/activity-element#resizeableActivity)) if the display's smallest\nwidth is \\\u003e= 600dp.\n**Figure 1.** Developer News feed previously letterboxed on large screen devices (left) runs full screen when targeting Android 16 (right).\n\nAndroid 16 enforces a consistent model of adaptive app design that optimizes the\nuser experience by respecting user preferences for device orientation, aspect\nratio, and display size.\n\nChanges\n-------\n\nThe following manifest attributes and APIs are ignored for apps targeting\nAndroid 16 (API level 36) on large screens:\n\n| Attribute or API | Ignored values |\n|---------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `screenOrientation` | `portrait`, `landscape`, `reversePortrait`, `reverseLandscape`, `sensorPortrait`, `sensorLandscape`, `userPortrait`, `userLandscape` |\n| `resizeableActivity` | all |\n| `minAspectRatio` | all |\n| `maxAspectRatio` | all |\n| `setRequestedOrientation()` `getRequestedOrientation()` | `portrait`, `landscape`, `reversePortrait`, `reverseLandscape`, `sensorPortrait`, `sensorLandscape`, `userPortrait`, `userLandscape` |\n\nExceptions\n----------\n\nExceptions to the Android 16 changes include the following:\n\n- Displays smaller than sw600dp (most phones, flippables, and outer displays\n of large screen foldables)\n\n- Games, based on the [`android:appCategory`](/guide/topics/manifest/application-element#appCategory) flag\n\n Publish your game using Android App Bundles and Play App Signing, allowing\n Google Play to manage the flag and provide the benefits of app bundles\n automatically. See also [App manifest overview](/guide/topics/manifest/manifest-intro).\n- User opt in to app's default behavior in the aspect ratio settings\n\nOpt out\n-------\n\nTo opt out of the API level 36 behavior, declare the\n`PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY` manifest property.\n\nTo opt out for a specific activity, set the property in the `\u003cactivity\u003e`\nelement: \n\n \u003cactivity ...\u003e\n \u003cproperty\n android:name=\"android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY\"\n android:value=\"true\" /\u003e\n ...\n \u003c/activity\u003e\n\nTo opt out for your entire app, set the property in the `\u003capplication\u003e` element: \n\n \u003capplication ...\u003e\n \u003cproperty\n android:name=\"android.window.PROPERTY_COMPAT_ALLOW_RESTRICTED_RESIZABILITY\"\n android:value=\"true\" /\u003e\n ...\n \u003c/application\u003e\n\n| **Warning:** The Android framework will eliminate the opt-out capability in API level 37. For apps that target API level 37 or higher, orientation, aspect ratio, and resizability restrictions will always be ignored on displays that are at least sw600dp.\n\nTests\n-----\n\nTo test whether your app is impacted by the Android 16 changes, use the Pixel\nTablet and Pixel Fold series emulators in Android Studio and set\n`targetSdkPreview = \"Baklava\"` in your app's module `build.gradle` file.\n\nOr use the app compatibility framework on your test devices by enabling the\n[UNIVERSAL_RESIZABLE_BY_DEFAULT](/about/versions/16/reference/compat-framework-changes#universal_resizable_by_default) flag (see [Compatibility framework tools](/guide/app-compatibility/test-debug)).\n\nYou can automate testing with the [Espresso](/training/testing/espresso) testing framework and [Jetpack\nCompose testing APIs](/develop/ui/compose/testing/apis).\n\nCommon problems\n---------------\n\nApps that restrict device orientation, aspect ratio, or app resizability might\nhave display issues on Android 16, such as overlapping layouts.\n\nTo provide an optimal user experience on phones, foldables, tablets,\nChromebooks, car displays, or XR, build your app to be responsive and adaptive:\n\n- **Avoid stretched UI components:** Layouts designed for standard, portrait\n phone screens will likely fail to accommodate other aspect ratios. For\n example, UI elements that fill the entire width of the display will appear\n stretched in landscape orientation. Add a maximum width to components to\n avoid stretching.\n\n- **Enable layouts to scroll:** If layouts don't scroll, users might not be\n able to access buttons or other UI elements that are off screen in landscape\n orientation. Enable app layouts to scroll to ensure all content is reachable\n regardless of the height of the display.\n\n- **Ensure camera compatibility in portrait and landscape:** Camera viewfinder\n previews that assume a specific aspect ratio and orientation relative to the\n camera sensor can result in stretched or flipped previews on nonconforming\n displays. Ensure viewfinders rotate properly with orientation changes.\n Enable viewfinders to adjust to UI aspect ratios that differ from the sensor\n aspect ratio.\n\n- **Preserve state during window size changes:** The removal of orientation\n and aspect ratio restrictions can result in frequent app window size changes\n in response to how users prefer to use an app, for example, by rotating,\n folding, or unfolding a device or by resizing an app in multi-window or\n desktop windowing mode. Configuration changes such as orientation changes\n and window resizing cause activity recreation (by default). To ensure an\n optimal user experience, preserve app state during configuration changes so\n your app retains data (such as form input) and users can maintain context.\n\n- **Use window size classes:** Support different window sizes and aspect\n ratios without device‑specific customizations. Assume window sizes\n will change frequently. Use window size classes to characterize the window\n dimensions, and then apply an appropriate adaptive layout.\n\n- **Build responsive layouts:** Within window size classes, responsive layouts\n adjust to changes in display dimensions to always create an optimal app\n presentation.\n\nTimeline\n--------\n\n- **Android 16 (2025):** Support for all orientations and aspect ratios and\n for app resizability is the baseline experience for large screen devices\n (smallest screen width \\\u003e= 600dp) for apps that target API level 36. However,\n developers can opt out.\n\n- **Android release in 2026:** Support for all orientations and aspect ratios\n and for app resizability will be the baseline experience for large screen\n devices (smallest screen width \\\u003e= 600dp) for apps that target API level 37.\n Developers will not have an option to opt out.\n\n| Target API level | Applicable devices | Developer opt out allowed |\n|------------------|--------------------------------------------------------|---------------------------|\n| 36 (Android 16) | Large screen devices (smallest screen width \\\u003e= 600dp) | Yes |\n| 37 (Anticipated) | Large screen devices (smallest screen width \\\u003e= 600dp) | No |\n\nThe deadlines for targeting specific API levels are app store specific. Google\nPlay will require apps to target API level 36 as of August 2026, API level 37 as\nof August 2027.\n\nAdditional resources\n--------------------\n\n- [Behavior changes: Apps targeting Android 16 or higher](/about/versions/16/behavior-changes-16)\n- [Build adaptive apps](/develop/ui/compose/build-adaptive-apps)\n- [Adaptive do's and don'ts](/develop/ui/compose/layouts/adaptive/adaptive-dos-and-donts)"]]