使用 <maskable-icon> 创建自适应图标

Her*_*gon 5 android android-studio android-8.0-oreo

我正在尝试使用本指南实施:

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

对于 Android O 预览版,但启动器向我显示了默认的 Android 图标,而不是我的 ic_launcher.xml 中指示的两个图层

ic_launcher.xml

<maskable-icon>
   <background android:drawable="@mipmap/layer0"/>
   <foreground android:drawable="@mipmap/layer1"/>
</maskable-icon>
Run Code Online (Sandbox Code Playgroud)

有没有人试图实现这一点?还是不可用?

(在我的清单中,我将 ic_launcher.xml 放在图标中)

更新: 谷歌更新您的网站并adaptive-icon改为maskable-icon

Chi*_*ato 4

当我检查下面的文件时,我找到了答案。

\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>
Run Code Online (Sandbox Code Playgroud)

我不知道最终哪个是对的。但目前(预览版 1),自适应图标标签似乎可以正常工作。