How to make application badge on android?

a 夏天 提交于 2019-12-17 16:28:06

问题


--Edit on 23 Apr 2016--

I finally use ShortcutBadger for most of the Device, I think that should be enough for me.

ShortcutBadger

Basically, Shortcut Badger will send broadcast, intent, etc to specific launcher, such as LG Launcher, to make a badge. It may not cover all the launchers but at least it works for the most recent smart phones.

--Edit--

What I am seeing on LG G2 (4.4), there is a number of some of the Apps, e.g. Line, which showing unread count.

This is the application badge I mean and I want to find a way to work that out.

This number will also be notified by the launcher itself, when the app in put inside a folder, the folder will also show the badge.

I think there should have ways to make it work, as I found several apps having badges.

--Original--

I did a search before and I found that there is a way to make application badge on Samsung and Sony, but what I want is to support other vendor, such as LG and HTC.

IS there an universal way to make an application badge?

Thanks for your help!


回答1:


Unfortunately, Android does not allow changing of the application icon because it's sealed in the APK once the program is compiled. There is no way to programmatically change it to a 'drawable'.

You may achieve your goal by using a widget instead of an icon. Widgets are highly customisable and can do what you want.

Original reference is here

You can also go with Badges library




回答2:


Stock Android does not offer this functionality at the moment on the standard launcher.

Certain manufacturers (e.g. Samsung notably, HTC, LG, Mi) have included this functionality into their customized Android launchers. Also some 3rd-party launchers (e.g. Nova Launcher) have included an API to accomplish this.

You may want to check following links for further explanation:

  1. How does Facebook add badge numbers on app icon in Android?
  2. Does Samsung modifies it's Android ROMs to have badges on email and SMS icons?
  3. How to make application badge on android?

Regards



来源:https://stackoverflow.com/questions/23713226/how-to-make-application-badge-on-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!