Make a dynamic launcher icon

2019-04-07 17:14发布

问题:

I want to create a launcher icon similar to the native Messaging application in Android. The icon of this app has an image but also have a dynamically changing number(a counter of some sort that corresponds to the number of unread messages). Also this icon it is not an widget, as it's an actual icon that's present in the application drawer.

Can someone explain to me how I can go about to achieve this? I found some solution that includes a widget with the dimensions set to 1x1 but I do not want people to add shortcuts to my app as widget. If possible, I'd want to manipulate the launcher icon in some programmatical way.

Thanks in advance!

Note: There is a question similar to mine asked a long time ago. However, seeing that the Android API has gone through a lot of changes since then, the older answers may or may not be applicable - hence the need for a new question. (link)

回答1:

Can someone explain me how can I do this ?

You can't, short of creating your own home screen with your own launcher.



回答2:

You cannot make an Dynamic launcher icon.

Alternatively, you can design a Home Screen Widget similar to your icon which can update itself.

Here's a tutorial on how to make a Home Screen Widget.

If you need to get that on the Menu of an Android Device, I think it is necessary what @CommonsWare said.