简体   繁体   English

无法更改我的 android 应用程序的图标

[英]Can't change icon for my android app

Firstly, I copied some icon to mipmap (named ic_launcher.png) - Didn't work.首先,我将一些图标复制到mipmap (名为 ic_launcher.png) - 没有用。

Second I right clicked res>new>image asset - Didn't work too.其次,我右键单击res>new>image asset - 也不起作用。

My manifest.xml code is as.我的 manifest.xml 代码如下。

 <application
    android:name=".BlogI"
    android:allowBackup="true"
    android:icon="@mipmap/applicationicon"  // This even shows the right icon in right corner along with the line numbers
    android:label="@string/app_name"
    ......
    ......

I tried clean project and rerun, restarted my android studio(even my PC) also restarted my android device.我尝试了干净的项目并重新运行,重新启动了我的 android studio(甚至我的 PC)也重新启动了我的 android 设备。 But, none of the above worked.但是,以上都没有奏效。 Before asking this question I tried other similar questions but none helped.在问这个问题之前,我尝试了其他类似的问题,但没有任何帮助。 Like this one. 像这个。

If there are any alternatives them please do suggest !如果有任何替代品,请提出建议! Thanks!谢谢!

When you generate image asset, delete ic_launcher.xml but keep the png files.生成图像资产时,删除ic_launcher.xml保留png文件。 xml file has ic_launcher_foreground attribute that overrides default android launcher icon. xml 文件具有 ic_launcher_foreground 属性,该属性会覆盖默认的 android 启动器图标。

First paste your image in drawable then add following code in manifest.xml首先将您的图像粘贴到drawable然后在manifest.xml添加以下代码

 <application
        android:name=".BlogI"
        android:allowBackup="true"
        android:icon="@drawable/your_Image"
        android:label="@string/app_name">`

It worked for me.它对我有用。

I finally found out the fix!我终于找到了解决办法! It was my 3rd party launcher (Evie Launcher) that didn't update the icons.是我的第 3 方启动器(Evie Launcher)没有更新图标。 The icons worked fine on all the devices here on including mine after I changed my launcher.更改启动器后,这些图标在包括我的在内的所有设备上都运行良好。

Thanks for all the suggestions and answers.感谢所有的建议和答案。

Finally found the mistake I was doing from long time.终于找到了我长期以来一直在做的错误。

Just make sure that in AndroidMainfest.xml you have set both properties - android:icon and android:roundIcon appropriately只需确保在AndroidMainfest.xml您已正确设置了两个属性 - android:iconandroid:roundIcon

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

I was just setting android:icon and kept android:roundIcon unchanged.我只是设置android:icon并保持android:roundIcon不变。

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

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