我从谷歌搜索,发现了几个答案。有人说samsung touchwiz可以做到这一点, see the link如何在启动图标上添加未读徽章数?
但是,我可以在Android 4.2.2的Nexus4中找到徽章图标。
那么,有没有任何技巧或私人API?
我从谷歌搜索,发现了几个答案。有人说samsung touchwiz可以做到这一点, see the link如何在启动图标上添加未读徽章数?
但是,我可以在Android 4.2.2的Nexus4中找到徽章图标。
那么,有没有任何技巧或私人API?
退房这个库:https://github.com/leolin310148/ShortcutBadger
用法很简单:
添加mavenCentral到您的构建脚本。
repositories {
mavenCentral()
}
为ShortcutBadger添加依赖关系,现在可以从maven获得。
dependencies {
compile 'me.leolin:ShortcutBadger:[email protected]'
}
添加以下代码:
int badgeCount = 1;
ShortcutBadger.with(getApplicationContext()).count(badgeCount);
如果你想删除的徽章
ShortcutBadger.with(getApplicationContext()).remove();
或
ShortcutBadger.with(getApplicationContext()).count(0);
计数不显示在mashmallow中 – Ashok
徽章图标都可以在应用程序中 - 就像不同的标签:https://github.com/jgilfelt/android-viewbadger
对于Android,它不允许,因为它是在APK密封在程序编译的应用程序图标的改变。显示应用程序通知的方式仅在状态栏中。检查这些链接:http://developer.android.com/guide/topics/ui/notifiers/notifications.html 和http://e2eapps.com/2010/01/21/android-push-notification-system/
你想要显示的数字可以出现在状态栏中。
这可能有所帮助:http://stackoverflow.com/questions/18285155/how-to-display-unread-count-to-the-android-app-icon – ashatte
非常感谢,但我不认为这是一个小工具〜 – kvh
你试过这个吗? http://stackoverflow.com/a/15249542/802421虽然您可能需要固定数量的图标(例如1,2,3,3+)。 – user802421