Translation: Configuring your apps and games for long-screen devices

Hello, Habr! I present to you the translation of Tuning your apps and games for long screen devices by Fred Chung.

In recent months, there has been a growing tendency for phone manufacturers to introduce new devices with a long screen (over 16: 9), many of which have rounded corners. The Pixel 2 XL and Huawei Mate 10 Pro are just two of many examples. These screen features can bring users an impressive experience, but they pay attention to applications and games that do not use a long format screen on new devices. Therefore, it is important for developers to optimize such screens. Let’s look at the corresponding support provided by the Android OS.

Optimization for long aspect ratio screens


Most applications using standard user interface widgets are more likely to work on these devices. The Android documentation clarifies methods for working flexibly on screens of different sizes. However, some games and user interface applications may run into problems due to incorrect assumptions regarding certain proportions. We share a few common problems that developers face, so you can pay attention to those that apply to you:

  •     Certain sides of the screen are cropped. Because of this, any graphic or user interface elements in the affected areas appear incomplete.
  •     Touch targets are offset from user interface elements (e.g. buttons). Users can confuse items
  •     In full-screen mode, at the rounded corners of the devices, any user interface elements that are very close to the corners may be outside the curved corner viewing area. Imagine that clicking on the "Buy" button for a commercial application is difficult? We recommend that you refer to material design guidelines , leaving 16dp side margins in layouts.

If a responsive user interface is really not suitable for your situation, in extreme cases, declare an explicit maximum supported aspect ratio as follows. On devices with a higher aspect ratio, the application will be shown in compatibility mode with the system mailbox. Keep in mind that some device models provide redefinition for users to make the application run in full-screen compatibility mode, so be sure to test this optimization method in this situation as well.

Targets API level 26 or higher: use attributes

android: maxAspectRatio

Targets API level 25 or lower: use metadata

android.max_aspect

Please note that maximum aspect ratios will only be respected if your actions do not support

resizableActivity

See the documentation for more details .

System mailboxes in the application are used when the declared maximum aspect ratio is less than the screen of the device.

image

Consider using parallel actions


Long aspect ratio devices provide even more multi-window capabilities, which can improve user productivity. Starting with Android 7.0, the platform offers a standard way for developers to implement multi-window mode on supported devices, as well as drag and drop data between existing windows. See the documentation for more details .

Testing is critical. If you do not have access to one of the devices with a long screen, be sure to check on the emulator the necessary screen properties and resolutions, which are described in the documentation of the emulator .

We know that you want to please your users with long-screen devices. With a few steps, you can ensure that your applications and games make full use of these devices!

Also popular now: