Android 8.0 startup icon adaptation

reference

  1. After discussing with the UI designer, divide the previous logo into two images, the foreground and the background.
  • The previous logo is as follows:
  • Now you need to separate the above image into foreground and background images as follows:
  1. Put the mouse focus on the src directory, press Windows: Ctrl+Shift+A or Mac: command+shft+A shortcut key, enter Image Asset. Open the Configure Image Asset window, as follows: When

    configuring, Previewthere is a circle in it to indicate Scope, the main content of the logo is displayed within this scope, and the outside of the scope will be automatically cropped when it is displayed on the mobile phone. PreviewThe Legacy Iconicon of the area represents the appearance of the startup icon on the 6.0 system.
  2. All that is left is to confirm the creation of the startup icon, and mipmap-anydpi-v26you will see two xml files in the folder, as follows:
ic_launcher.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
ic_launcher_round.xml
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@mipmap/ic_launcher_background"/>
    <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

ic_launcher_backgroundAnd the ic_launcher_foregroundpicture is generated by the second step configuration, and then the manifest file is also configured android:icon="@mipmap/ic_launcher", and it is successful here.
4. Question

  • android:roundIcon="@mipmap/ic_launcher_round": This is only available in the Android 7.1 system over version, don't care.
  • If you want to use the startup icon for other layouts, it is recommended to use it @mipmap/ic_launcher. It will present different styles according to different versions of the system. The effect is the styles previewed in the Configure Image Asset window. Some domestic machines are used in other layouts @mipmap/ic_launchereven if the system is above 8.0. style or 6.0 system icons, but I use the phone abroad also tested, some foreign mobile phones like SM-J330G, HUAWEI ATU-L22, OPPO CPH1803these models can be done automatically adapted in other layouts.

Guess you like

Origin blog.csdn.net/MoLiao2046/article/details/107144227