5

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

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

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

ic_launcher.xml

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

有没有人试图实现这一点?或者仍然不可用?

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

更新: 谷歌更新你的网站,并adaptive-iconmaskable-icon

4

3 回答 3

3

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

\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>

我不知道最终哪个是对的。但是现在(预览版 1),adaptive-icon 标签似乎可以正常工作。

于 2017-03-23T10:20:36.767 回答
1

您是否忘记在清单中定义它?

<application
        ...
        android:icon="@mipmap/ic_launcher"
        ...>

    ...

</application>
于 2017-03-23T06:25:17.637 回答
0

您可能还必须将其添加到您的 AndroidManifest.xml 文件中:

android:roundIcon="@mipmap/ic_launcher_round"
于 2017-06-09T16:04:55.807 回答