1

我正在开发一个 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"
4

2 回答 2

5

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

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

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

于 2018-10-23T12:35:10.393 回答
3

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

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

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

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

(右键单击)-> 新建-> 图像资源

于 2018-10-23T12:35:12.460 回答