繁体   English   中英

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

[英]Creating Adaptive Icons with <maskable-icon>

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

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>

有没有人试图实现这个? 或者还没有?

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

更新: Google更新您的网站并将adaptive-icon改为maskable-icon

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

\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-label标签似乎正常工作。

你忘了在清单中定义它吗?

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

    ...

</application>

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

android:roundIcon="@mipmap/ic_launcher_round"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM