【问题标题】:@mipmap/ic_launcher not being used for app icon@mipmap/ic_launcher 未用于应用程序图标
【发布时间】:2018-07-06 16:37:55
【问题描述】:

我正在更改应用启动器图标,并使用instructions 修改了res/mipmap/ic_launcher 图标。在 Android Studio 中,我看到了正确的修改图标。

但是,设备上仍显示原来的默认图标,而不是我绑定到 ic_launcher 的新图标。我的清单使用指向新值 AFAICT。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="app.anytune.rxsongbrowsertrials">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
....
</manifest>

为什么不使用ic_launcher 图标?

【问题讨论】:

  • 尝试删除mipmap各个文件夹中的所有现有图标,例如mipmap-hdpi、xhdpi等。
  • 我从 mipmap ic_launcher 文件的 Android Studio 视图和文件系统中都检查了,只有新图标存在。我已从设备中删除了该应用程序,并清理并重建了该项目。仍然得到旧图标。我不知道它可能来自哪里。
  • 普通图标和圆形图标你都改了吗?
  • 是的,它们都显示在我上面的清单中。两者都指向同一个@mipmap/ic_launcher,我检查它是否是各种分辨率的正确版本。
  • 是否存在可能缺少的通用分辨率?

标签: android android-studio


【解决方案1】:

我发现了错误。使用Image Asset Studio 工具,它在 ic_launcher 资源中为普通 (res/mipmap/ic_launcher) 和圆形版本 (res/mipmap/ic_launcher_round) 版本创建了我的新启动图标,分辨率如下:dpi, dpi, xhdpi, xxhdpi, xxxhdpi。这些都是 png 文件,所以这些文件可能仍然有问题,因为我希望它们是 .xml 文件。

但是,它没有更新anydpi-v26 分辨率。这仍然是指带有模板图像的原始可绘制对象。我需要手动更新前景标签以使用我的新可绘制对象。

【讨论】:

    【解决方案2】:

    尝试使用此插件导入新图标,并将其重命名为 customIcon,设置替换 @mipmap/ic_launcher 为 @drawable/customIcon 。不需要扩展名,请确保将其替换为圆形和正常

    https://plugins.jetbrains.com/plugin/7658-android-drawable-importer

    这里有一个来自一个工作项目的示例

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher_new"
        android:label="AMVT App Móvil"
        android:roundIcon="@drawable/ic_launcher_new"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
    

    如果你需要创建一个简单的图标,你可以使用这个工具 Android Asset Studio

    【讨论】:

    • 不清楚这个插件有什么帮助。我有一个我想使用的应用程序图标的.svg 文件,并且之前使用了 Android Asset Studio,这导致了之前的问题。我看不到如何使用这个插件来接受我的.svg 文件。它甚至会创建 mipmap 文件,还是只是创建可以正常工作和调整大小的可绘制对象?
    • 安装插件并按照以下步骤操作i.imgur.com/P3O0IvC.png 然后按 + 选择您的文件和资源i.imgur.com/YbiNEtD.png
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-10-21
    • 2023-04-07
    • 2011-09-19
    • 1970-01-01
    • 2021-09-15
    • 2014-07-19
    相关资源
    最近更新 更多