Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up the Android emulator with a larger screen aspect ratio

In March 2017, an announcement was made that two Android devices — the Samsung Galaxy S8 and the LG G6 — were being introduced with new, longer, screen aspect ratios of 18:9 and 18.5:9.

According to the announcement, legacy apps with no android.max_aspect or android.resizeableActivity value in their manifest would take on a maximum aspect ratio of 1.86 (roughly 16:9) by default. The announcement shows an image of such an app running on one of the new device screens with its content "letterboxed" in the display with black bars shown along the top and bottom of the screen.

How can I set up the Android emulator to display one of the new, longer 18:9 screens? Manually setting the emulator screen resolution doesn’t show the letterboxed effect.

like image 225
rmtheis Avatar asked Mar 31 '17 23:03

rmtheis


People also ask

How do I increase the size of my emulator screen?

With Android Studio 2 now you can resize your window simply by dragging a corner.

How can I make Android apps compatible with all screen sizes?

Use weight for all layouts instead of giving constant values, Because weight is a type of % for screen.In manifest by default support screen view is true. Show activity on this post. These links will help you to create application for multiple screens : http://developer.android.com/training/multiscreen/screensizes.html.


2 Answers

This is not an answer per se, but I did find some helpful information in the docs.

First, read this note about android.max_aspect from the original announcement:

Note: if you don't set a value, and android:resizeableActivity is not true, then the maximum aspect ratio defaults to 1.86 (roughly 16:9) and your app will not take advantage of the extra screen space.

Now see these docs:

You do not need to set a maximum aspect ratio if an activity's android:resizeableActivity attribute is set to true. If your app targets API level 24 or higher, this attribute defaults to true.

This means the "letter-boxing" issue will only happen if both of these conditions are true:

  1. The device has a large aspect ratio (> 1.86:1 or 16:9), and,
  2. The app targets API 23 or below

So I suspect the situation is not too bad - not many apps will be affected.

like image 136
Vicky Chijwani Avatar answered Nov 09 '22 07:11

Vicky Chijwani


Try these steps:

  • In Android Studio, open AVD Manager
  • Create Virtual Device
    • New Hardware Profile
    • Set name: "18:9 aspect ratio screen"
    • Set resolution: 1080 x 2160
    • Finish
  • Select "18:9 aspect ratio screen"
  • Next
  • Select system image Nougat (API Level 25)
  • Next
  • AVD Name: "25 N.1 18x9 aspect ratio screen" [starting AVD names with the API level gets the list sorted by that]
  • Finish
like image 38
Jerry101 Avatar answered Nov 09 '22 07:11

Jerry101