In the past month, LG and Samsung have both released handsets that offer fairly unique aspect ratios. As companies start to push the bezel-less boundaries over the next few years, app developers will most likely want to take advantage and present their apps in the best way possible. Today, the Android Developers Blog has highlighted how to code apps to take advantage of these expanded screen ratios.
Now, in order to scale apps to the newer formats that are arriving, the blog recommends developers adjust the maximum supported ratio in their apps.
This can be done by:
Simply declaring an android.max_aspect <meta-data> element in the app's <application> element:<meta-data android:name="android.max_aspect" android:value="ratio_float"/>
Where ratio_float is the maximum aspect ratio your app can support, expressed as (longer dimension / shorter dimension) in decimal form.
We recommend that you design your app to support aspect ratios of 2.1 or higher. For this, you would add the following to the <application> element:<meta-data android:name="android.max_aspect" android:value="2.1" />
<meta-data android:name="android.max_aspect" android:value="ratio_float"/>
<meta-data android:name="android.max_aspect" android:value="2.1" />
These values will need to be changed due to the existing default that is set roughly to a 16:9 aspect ratio. Both the LG G6 and Samsung Galaxy S8 and S8+ will arrive next month. LG's will offer an 18:9, while Samsung's will offer an 18.5:9 aspect ratio.
Source: Android Developers Blog
7 Comments - Add comment