I know that same kind of question has been asked for activity icon, but my question is little bit different.
我知道在activity icon上也有人问过同样的问题,但我的问题有点不同。
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>
In the above example I am setting it in manifest file, but instead of manifest can I set it through java code.
在上面的示例中,我将它设置为manifest文件,但是我可以通过java代码而不是manifest设置它。
2 个解决方案
#1
3
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.
你可以在这里看到http://developer.android.com/guide/topics/manifest -intro.html,默认的app图标设置在清单中。由于manifest位于应用程序的/根目录中,所以无法修改它,因此无法进行修改。您可能会认为,如果您可以在应用程序运行时更改它,那么更改将不会保存在清单中。
#2
0
manifest can't be changed dynamically but it trick that you can remove icon app and then add icon you like here is the link : How to change an application icon programmatically in Android?
manifest不能被动态改变,但它的诀窍在于你可以移除图标应用然后添加你喜欢的图标这里有链接:如何在Android中以编程的方式修改应用图标?
#1
3
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.
你可以在这里看到http://developer.android.com/guide/topics/manifest -intro.html,默认的app图标设置在清单中。由于manifest位于应用程序的/根目录中,所以无法修改它,因此无法进行修改。您可能会认为,如果您可以在应用程序运行时更改它,那么更改将不会保存在清单中。
#2
0
manifest can't be changed dynamically but it trick that you can remove icon app and then add icon you like here is the link : How to change an application icon programmatically in Android?
manifest不能被动态改变,但它的诀窍在于你可以移除图标应用然后添加你喜欢的图标这里有链接:如何在Android中以编程的方式修改应用图标?