ic_launcher.xml 未被用作应用程序图标

Inv*_*Zim 1 xml android appicon

我正在开发一个 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>
Run Code Online (Sandbox Code Playgroud)

两个 xml 文件的代码相同。

问题是在较新的 os 版本(8.0+,圆形图标)上它运行良好,但在早期版本中它不起作用(7.0,方形图标)它根本不起作用,并且默认为标准的 android 图标。

我目前正在创建我将用来替换 mipmap 中的 ic_launcher.png 的所有图像,但除此之外我还能做些什么吗?

在清单中,我将它们用作:

android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
Run Code Online (Sandbox Code Playgroud)

ILL*_*NKO 5

您可以使用 Android Studio 工具自定义应用的图标。

  1. 在 Project 窗口中,选择 Android 视图。
  2. 右键单击 res 文件夹并选择新建 > 图像资源。

更多:https : //developer.android.com/studio/write/image-asset-studio