Android Studio Image Asset Launcher Icon Transparent Background Color

后端 未结 4 1111
遇见更好的自我
遇见更好的自我 2020-12-08 07:46

You might be thinking this question is a duplicate of this one. But since then, Android Studio has been updated and the solution given there is not working anymore.

4条回答
  •  醉话见心
    2020-12-08 08:03

    In Android 5.0 an icon always got an opaque background until I created a transparent file.

    1. File > New > Image Asset.
    2. Turn to Launcher Icons (Adaptive and Legacy) in Icon Type.
    3. Choose Image in Asset Type and select your picture inside Path field (Foreground Layer tab).
    4. Create or download below a PNG file with transparent background of 512x512 px size (this is a size of ic_launcher-web.png).
    5. In Background Layer tab select Image in Asset Type and load the transparent background from step 4.
    6. In Legacy tab select Yes for all Generate, None for Shape.
    7. In Foreground Layer and Background Layer tabs you can change trim size.

    Though you will see a black background behind the image in Preview window, after pressing Next, Finish and compiling an application you will see a transparent background in Android 5, Android 8.

    Here is the transparent image:

提交回复
热议问题