Android 更改应用程序图标

Android change app icon

我真的不知道如何更改安装应用程序时出现的应用程序图标,您必须单击屏幕上的图标。

我做了什么:

没什么。我的应用程序仍然带有烦人的默认 mipmap ic_launcher 图标。

除了这个我真的不知道还能做什么..

谁能帮帮我?

编辑: 对不起,我忘了清单。

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true" >
...
...
</application>

您在清单中的 <application> 标签下设置了您的应用程序图标:

<application
    android:icon="@drawable/myIcon" >
</application>

然后确保您的资源文件夹(hdpi、xhdpi 等)中有一个文件(例如 myIcon.png

如果您没有卸载旧图标的应用程序并对其进行升级,则有可能由于缓存而显示旧图标。强制停止应用程序可能会有所帮助。

先将icon.png文件粘贴到drawable文件夹中,修改代码如下

    <application
          android:allowBackup="true"
          android:icon="@mipmap/icon"
          android:label="@string/app_name"
          android:supportsRtl="true" >

    </application>

使用此面通过上传图片创建图标(使用图片按钮)

https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html#foreground.space.trim=1&foreground.space.pad=0&foreColor=607d8b%2C0&crop=0&backgroundShape=square&backColor=ffffff%2C100&effects=none

然后下载并将其保存在应用程序的可绘制文件夹中,然后使用

 <application
      android:icon="@drawable/myIcon" >
 </application>

在清单文件中。

https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html#foreground.space.trim=1&foreground.space.pad=0&foreColor=607d8b%2C0&crop=0&backgroundShape=square&backColor=ffffff%2C100&effects=none

生成图标并使用上面给出的方法下载 zip 文件后,从 zip 文件中提取 res 文件夹并覆盖应用程序的 res 文件夹(通过粘贴到位置,例如 C:\MyApplicaton\app\src\main)这个 res 文件夹然后是你的代码

android:icon="@mipmap/ic_launcher"

会起作用。
注意:通过覆盖 res 文件夹,它只会添加或覆盖 mipmap 文件夹,旧文件夹将保持原样。

你必须在上面给出的帮助下根据图标大小用新的 ic_launcher 替换所有 mipmap 文件夹中的 ic_launcher 图标。

然后它将起作用

文件夹名称如

mipmap-hdpi

mipmap-mdpi

mipmap-xhdpi

mipmap-xxhdpi

那么您下面给出的代码将起作用

   <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true" >
 ...
 ...
 </application>

正如 Suke 指出的那样,我忘记发布这个问题的解决方案了。对不起大家。

经过大量管理,解决方案很简单,就是 google 的那个。

this link 是您可以为 android 项目创建所有图像的地方。

去那里然后:

  • 插入您的图片和select所有特征
  • 下载它
  • 替换您的 drawable-xxhdpi、drawable xhdpi...和 ​​mipmap-xxhdpi、mipmap-xhdpi...文件夹中的所有图像格式(xxhdpi、hdpi...)。
  • 在清单中设置 android:icon = "@drawable/myicon"

我就是这样做的

希望对您有所帮助

在清单中添加 android:icon="@drawable/Icon" 在

<application android:icon="@drawable/Icon" > </application>

确保图标存在于文件夹中

还要确保使用新值更新 android:roundIcon="@mipmap/ic_launcher_round",这对 android 的较新版本有效。

如果您仍然看到默认的 android 图标,修复它很简单... 您可以使用此工具生成所有尺寸的图标。 https://appicon.co/ 在 app res 文件夹中解压缩 mipmap 调整大小的文件。 然后在 /mipmap-anydpi-v26/ 文件夹中,删除两个 XML 文件。

现在在清单中的 <application> 标记中,为 android:iconandroid:roundIcon 设置图标。

正如其他人所指出的,我用 this link 创建了一个图标。在我的例子中,我必须将以下两个参数调整为我在 res 中添加的图标名称。

<application
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher">
</application>