gpt4 book ai didi

android - ic_launcher.xml 未用作应用程序图标

转载 作者:行者123 更新时间:2023-11-29 14:43:11 25 4
gpt4 key购买 nike

我正在开发 Android 应用。

我正在尝试使用 ic_launcher.xml 和 ic_launcher_round.xml 作为应用程序图标,因为我认为这是正确的方法吗?

无论如何,我有一张 png 图片,108x108 像素,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 的所有图像,但除此之外我还能做点别的吗?

在 list 中,我将它们用作:

android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"

最佳答案

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

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

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

关于android - ic_launcher.xml 未用作应用程序图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52949065/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com