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

时间:2018-10-23 12:26:23

标签: android xml 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>

两个xml文件的代码相同。

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

我目前正在创建将用于替换mipmaps中的ic_launcher.png的所有图像,但是除此之外,我还能做些其他事情吗?

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

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

2 个答案:

答案 0 :(得分:2)

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

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

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

答案 1 :(得分:1)

我建议您至少使用512x512像素的图像来生成应用程序的启动器图标。

有个很棒的在线工具可以生成适合所有屏幕的启动器图标:

http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

或者您可以使用Android Studio的默认工具导入图像并生成图像。

(右键单击)->新建->图片资产

相关问题