我正在开发一个 Android 应用程序。
我正在尝试使用 ic_launcher.xml 和 ic_launcher_round.xml 作为应用程序图标,因为我认为这是正确的方法?
无论如何,我有一张 png 图像,108x108px,32 位颜色。我在 ic_launcher 和 ic_launcher_round 中都使用它:
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/app_icon" />
</adaptive-icon>
两个 xml 文件的代码相同。
问题是在较新的操作系统版本(8.0+,圆形图标)上它运行良好,但在早期版本(7.0,方形图标)上它根本不起作用,并且默认为标准 android 图标。
我目前正在创建所有用于替换 mipmap 中的 ic_launcher.png 的图像,但除此之外我还能做些什么吗?
在清单中,我将它们用作:
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"