Maximum aspect ratio
The cover display will have a long (21:9) aspect ratio.
So the application needs to handle a maximum aspect ratio to fill the entire screen.
The public guide is found in the Android developer site:
In the guideline, you can choose the following options to support aspect ratio.
Declare the target SDK version
Apps that targets Android 8.0 (API level 26) or higher, they will fill the entire screen.
Declare the resizeableActivity
If the activity is resizable, your Activity will fill the entire screen.
Code Block 2 Set attribute in your manifest's
android:resizeableActivity=["true" | "false"]
Declare a max aspect ratio
For Android 7.1 and lower, add a
element named android.max_aspect in the element.
Code Block 3 meta-data android.max_aspect
<!-- Render on full screen up to screen aspect ratio of 2.4 --> <!-- Use a letterbox on screens larger than 2.4 --> <meta-data android:name="android.max_aspect" android:value="2.4" />
If an app does not support a long aspect ratio (9:21), it may not be resized properly when unfolded in emulator environment. Please make sure the app support a long aspect ratio first before testing folding and unfolding.
Optimized layouts for cover display and main display
Now the app will run in both displays even with different sizes.
We recommend adding a separate resource folder to show more rich and clear content.
How to optimize layouts
Refer to the following link to get the default information about separate resource folder.
Reference display configuration
See the foldable device configurations below for each display.
|Cover display||Main display|
|smallest width||320 dp||585 dp|
|screen size||840 x 1960||1536 x 2152|