如何在Android中动态更改Android应用程序图标 [英] How can we change android application icon dynamically in Android

查看:357
本文介绍了如何在Android中动态更改Android应用程序图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道同样的问题已被要求提供活动图标,但我的问题略有不同。

I know that same kind of question has been asked for activity icon, but my question is little bit different.

我只是想知道我们是否可以设置应用程序图标以编程方式,我不是要求更改,我只是要求设置它。我希望我很清楚。

I just wanted to know whether we can set the application icon programmatically, I am not asking to change, I am just asking for setting it. I hope I am clear.

<application android:icon="drawable resource"> </application>

在上面的示例中,我在清单文件中设置它,但是我可以通过清单设置它java代码。

In the above example I am setting it in manifest file, but instead of manifest can I set it through java code.

推荐答案

正如你可以在这里阅读 http://developer.android.com/guide/topics/manifest/manifest-intro.html 默认的应用程序图标在清单中设置。由于清单位于应用程序的/ root中,因此无法修改,因此无法执行此操作。
您可以考虑如果您可以在应用程序运行时更改它,则更改将不会保存在清单中。

As you can read here http://developer.android.com/guide/topics/manifest/manifest-intro.html the default's app icon is set in the manifest. As manifest is located in the app's /root it cannot be modified, so there's no way to do it. You may consider that if you could change it while the app is running, changes wouldn't be saved in the manifest.

这篇关于如何在Android中动态更改Android应用程序图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆