⬆️ ⬇️

Translation: Setting up your applications and games for devices with a long screen

Hi, Habr! I present to you the translation of the article by Fred Chung's Tuning article.



In recent months, there is a growing tendency for phone manufacturers to introduce new devices with a long screen (more than 16: 9), many of which have rounded corners. 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 draw 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 take a look at the appropriate support provided by the Android OS.



Optimized for screens with a long aspect ratio



Most applications using standard user interface widgets will most likely run on these devices. The Android documentation specifies methods for flexible working on screens of different sizes. However, some games and applications with user interfaces may run into problems due to incorrect assumptions about certain proportions. We share several typical problems that developers face, so you can look at those that apply to you:

')



If a responsive user interface is not really appropriate 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.



Targets API level 26 or higher: use attributes



android: maxAspectRatio 


Targets API level 25 or lower: use metadata



 android.max_aspect 


Please note that the maximum aspect ratio values ​​will be observed only if your actions do not support



 resizableActivity 


For more information, see the documentation .



The system mailboxes in the application are used when the declared maximum aspect ratio is smaller than the device screen.



image



Consider using parallel actions.



Devices with a long aspect ratio provide even more options for using multiple windows, 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 to drag and drop data between active windows. See the documentation for details.



Testing is crucial. 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 emulator documentation .



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

Source: https://habr.com/ru/post/345438/



All Articles