我们正在实现一个圆形图标(具有前景和背景)和图标。
<application
android:allowBackup="false"
tools:replace="android:allowBackup"
android:label="@string/app_name"
android:supportsRtl="true"
android:icon="@mipmap/logo" //normal logo
android:roundIcon="@mipmap/logo_o" //Our logo with foreground and background
android:name=".MyApplication"/>适用于所有版本,但不适用于API 25

我们的带有背景的前景的代码是下一个
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@mipmap/logo_background"/>
<foreground android:drawable="@mipmap/logo_foreground"/>
</adaptive-icon>发布于 2018-11-08 08:56:50
资源结构:
mipmap-anydpi-v25
\ ic_launcher_round.xml
mipmap-anydpi-v26
\ ic_launcher.xml
mipmap-*dpi
\ ic_launcher.pngAndroidManifest.xml:
<application android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"为roundIcon资源添加资源重定向,这样可以保证在roundIcon级别的26+上有v26自适应图标:
values-anydpi-v26
\ drawables.xmldrawables.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<mipmap name="ic_launcher_round">@mipmap/ic_launcher</mipmap>
</resources>发布于 2018-11-08 08:00:40
在我的例子中,这是由于删除圆形图标的PNG/位图版本造成的。
我只保留了圆形图标的mipmap-anydpi-v26 XML版本。并删除了mipmap-hdpi,mipmap-mdpi等文件夹中所有的圆形图标,认为它们无用。
当删除PNG位图的圆形版本时,它可以在除Android 7.1API level 25之外的所有Android版本(> 4.0)上正常工作。
发布于 2018-11-08 09:36:42
您可以添加其他图标:

在清单中:
<application
android:name=".MiseApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"`https://stackoverflow.com/questions/51776821
复制相似问题