Search code examples
androidandroid-studioandroid-8.0-oreo

Creating Adaptive Icons with <maskable-icon>


I'm trying to implement with this guide:

https://developer.android.com/preview/features/adaptive-icons.html#Creating

for Android O Preview but the launcher shows me the default Android icon and not the two layers indicated in my ic_launcher.xml

ic_launcher.xml

<maskable-icon>
   <background android:drawable="@mipmap/layer0"/>
   <foreground android:drawable="@mipmap/layer1"/>
</maskable-icon>

Has anyone tried to implement this? Or is not still available?

(In my manifest I put the ic_launcher.xml in icon)

UPDATE: Google updates your website and put adaptive-icon instead maskable-icon


Solution

  • I found out an answer when I check the file below.

    \android-sdk-windows\platforms\android-O\data\res\drawable\sym_def_app_icon.xml
    
    <?xml version="1.0" encoding="utf-8"?>
    <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
        <background android:drawable="@android:color/white" />
        <foreground android:drawable="@mipmap/sym_def_app_icon_maskable" />
    </adaptive-icon>
    

    I don't know which is eventually right. But for now(preview 1), adaptive-icon tag seems to work correctly.