简体   繁体   中英

how can i set the application icon programmatically android

我知道我们可以使用android:icon属性通过清单文件进行设置,但是如何在Java代码中进行设置呢?

It doesn't make sense to set it programmatically, the launcher has to display the application icon when the application isn't active.

If you take a look at How to change an application icon programmatically in Android? , you will find a comment, which links to this sample code in the Android developer API demos: LaucherShortcuts .

It seams that the Activity can create a LauncherShortcut, which can have a different icon (see function setupShortcut()). If you want the user to select the Icon, you have to display a list of icons when creating the shortcut. But again, it is a shortcut. In the list of application the original icon appears.

我不认为可以通过编程方式设置启动器图标。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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