简体   繁体   English

Android更改应用图标

[英]Android change app icon

I can't really figure out how to change the app's icon that appears when you install the app, the one on the screen that you have to click. 我无法弄清楚如何更改安装应用程序时显示的应用程序图标,即您必须单击的屏幕上的应用程序图标。

What i did: 我做了什么:

  • I created a new icon --> new > Image asset (mipmap) 我创建了一个新图标 - >新建>图像资源(mipmap)
  • I deleted ic_launcher (the default one) 我删除了ic_launcher(默认的)
  • I named the new asset like the old icon (ic_launcher) 我将新资源命名为旧图标(ic_launcher)
  • Rebuild 重建
  • Clean project 清洁项目
  • Invalidate cache and restart 使缓存无效并重新启动
  • Installed app 已安装的应用

nothing. 没有。 I still have my app with the annoying default mipmap ic_launcher icon. 我仍然有我的应用程序与恼人的默认mipmap ic_launcher图标。

I don't really know what to do more than this.. 我真的不知道该做什么比这更多..

Can anyone help me? 谁能帮我?

EDIT: Sorry, I forgot the manifest. 编辑:对不起,我忘记了清单。

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

As Suke pointed I forgot posting the solution for this question. 正如Suke指出的那样,我忘了发布这个问题的解决方案。 Sorry all. 对不起。

After a lot of managements the solution was easy and it was the one google's one. 经过大量的管理后,解决方案很简单,而且只有谷歌的一个。

this link is where you can create all images for android project. 这个链接是你可以为android项目创建所有图像的地方。

Go there and: 去那里:

  • insert your image and select all features 插入图像并选择所有功能
  • download it 下载它
  • replace all image formats (xxhdpi, hdpi, ...) in your drawable-xxhdpi, drawable xhdpi,... and mipmap-xxhdpi, mipmap-xhdpi,... folders. 替换drawable-xxhdpi,drawable xhdpi,...和mipmap-xxhdpi,mipmap-xhdpi,...文件夹中的所有图像格式(xxhdpi,hdpi,...)。
  • in manifest set the android:icon = "@drawable/myicon" 在清单中设置android:icon = "@drawable/myicon"

this is how I did it 这就是我做到的

hope it helps 希望能帮助到你

use this side to create icon by uploading the image (use image button) 使用此侧通过上传图像创建图标(使用图像按钮)

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 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

and then download and save this in drawable folder of your app and then use 然后下载并将其保存在应用程序的drawable文件夹中,然后使用

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

in manifests file. 在清单文件中。

You set your application icon under the <application> tag in your manifest: 您可以在清单中的<application>标记下设置应用程序图标:

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

Then just make sure you have a file (such as myIcon.png ) within your resources folder (hdpi, xhdpi, etc) 然后确保在资源文件夹(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 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

After generating your icon and downloading the zip file by using the side given above then extract the res folder from zip file and overwrite res folder(by pasting at location eg C:\\MyApplicaton\\app\\src\\main) of your app with this res folder then your code 生成您的图标并使用上面给出的一侧下载zip文件然后从zip文件中提取res文件夹并覆盖您的应用程序的res文件夹(通过粘贴位置,例如C:\\ MyApplicaton \\ app \\ src \\ main)文件夹然后你的代码

android:icon="@mipmap/ic_launcher"

will work. 将工作。
Note: by overwriting res folder it only add or overwrite the mipmap folders and old folder will remain as it was. 注意:通过覆盖res文件夹,它只添加或覆盖mipmap文件夹,旧文件夹将保持不变。

OR 要么

you have to replace the ic_launcher icon in all mipmap folder with new ic_launcher according to the icon size with the help of the side given above. 你必须在上面给出的一方的帮助下,根据图标大小用新的ic_launcher替换所有mipmap文件夹中的ic_launcher图标。

then it will work 然后它会工作

folder name like 文件夹名称就像

mipmap-hdpi 纹理贴图,华电国际

mipmap-mdpi 纹理贴图,MDPI

mipmap-xhdpi 纹理贴图,xhdpi

mipmap-xxhdpi 纹理贴图,xxhdpi

Then your code as given below will work 那么下面给出的代码就可以了

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

In the Manifest add android:icon="@drawable/Icon" in the 在Manifest中添加android:icon =“@ drawable / Icon”

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

make sure that the icon is present in the folder 确保文件夹中存在图标

If you did not uninstall the App with the old icon and upgraded over it, there is a chance it may display the old icon due to cache. 如果您没有使用旧图标卸载应用程序并对其进行升级,则可能会因缓存而显示旧图标。 Force stopping the App may help. 强制停止App可能有所帮助。

first paste icon.png file in drawable folder and modify your code as below 首先在可绘制文件夹中粘贴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有效。

If you still see default android icon, it's simple to fix it... You can use this tools to generate an all-sizes icon. 如果您仍然看到默认的android图标,则修复它很简单...您可以使用此工具生成全尺寸图标。 https://appicon.co/ Unzip the mipmap resized file in app res folder. https://appicon.co/在app res文件夹中解压缩mipmap已调整大小的文件。 Then in /mipmap-anydpi-v26/ folder, delete both XML files. 然后在/ mipmap-anydpi-v26 /文件夹中,删除两个XML文件。

Now in the manifest, in the <application> tag, set your icon for both android:icon & android:roundIcon . 现在在清单中,在<application>标签中,为android:iconandroid:roundIcon设置你的图标。

As others have pointed out, I created an icon with this link . 正如其他人所指出的,我用这个链接创建了一个图标。 In my case, I had to adjust both the following parameters to the icon name I added in res. 在我的情况下,我不得不将以下参数调整为我在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