繁体   English   中英

Android更改应用图标

[英]Android change app icon

我无法弄清楚如何更改安装应用程序时显示的应用程序图标,即您必须单击的屏幕上的应用程序图标。

我做了什么:

  • 我创建了一个新图标 - >新建>图像资源(mipmap)
  • 我删除了ic_launcher(默认的)
  • 我将新资源命名为旧图标(ic_launcher)
  • 重建
  • 清洁项目
  • 使缓存无效并重新启动
  • 已安装的应用

没有。 我仍然有我的应用程序与恼人的默认mipmap ic_launcher图标。

我真的不知道该做什么比这更多..

谁能帮我?

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

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

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

经过大量的管理后,解决方案很简单,而且只有谷歌的一个。

这个链接是你可以为android项目创建所有图像的地方。

去那里:

  • 插入图像并选择所有功能
  • 下载它
  • 替换drawable-xxhdpi,drawable xhdpi,...和mipmap-xxhdpi,mipmap-xhdpi,...文件夹中的所有图像格式(xxhdpi,hdpi,...)。
  • 在清单中设置android:icon = "@drawable/myicon"

这就是我做到的

希望能帮助到你

使用此侧通过上传图像创建图标(使用图像按钮)

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

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

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

在清单文件中。

您可以在清单中的<application>标记下设置应用程序图标:

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

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

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)文件夹然后你的代码

android:icon="@mipmap/ic_launcher"

将工作。
注意:通过覆盖res文件夹,它只添加或覆盖mipmap文件夹,旧文件夹将保持不变。

要么

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

然后它会工作

文件夹名称就像

纹理贴图,华电国际

纹理贴图,MDPI

纹理贴图,xhdpi

纹理贴图,xxhdpi

那么下面给出的代码就可以了

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

在Manifest中添加android:icon =“@ drawable / Icon”

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

确保文件夹中存在图标

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

首先在可绘制文件夹中粘贴icon.png文件并修改您的代码,如下所示

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

    </application>

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

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

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

正如其他人所指出的,我用这个链接创建了一个图标。 在我的情况下,我不得不将以下参数调整为我在res中添加的图标名称。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM