2013-10-09 44 views
1

我从谷歌搜索,发现了几个答案。有人说samsung touchwiz可以做到这一点, see the link如何在启动图标上添加未读徽章数?

但是,我可以在Android 4.2.2的Nexus4中找到徽章图标。

那么,有没有任何技巧或私人API?

+2

这可能有所帮助:http://stackoverflow.com/questions/18285155/how-to-display-unread-count-to-the-android-app-icon – ashatte

+0

非常感谢,但我不认为这是一个小工具〜 – kvh

+0

你试过这个吗? http://stackoverflow.com/a/15249542/802421虽然您可能需要固定数量的图标(例如1,2,3,3+)。 – user802421

回答

2

退房这个库:https://github.com/leolin310148/ShortcutBadger

用法很简单:

  1. 添加mavenCentral到您的构建脚本。

    repositories { 
        mavenCentral() 
    } 
    
  2. 为ShortcutBadger添加依赖关系,现在可以从maven获得。

    dependencies { 
        compile 'me.leolin:ShortcutBadger:[email protected]' 
    } 
    
  3. 添加以下代码:

    int badgeCount = 1; 
    
    ShortcutBadger.with(getApplicationContext()).count(badgeCount); 
    
  4. 如果你想删除的徽章

    ShortcutBadger.with(getApplicationContext()).remove(); 
    

    ShortcutBadger.with(getApplicationContext()).count(0); 
    
+0

计数不显示在mashmallow中 – Ashok

0

徽章图标都可以在应用程序中 - 就像不同的标签:https://github.com/jgilfelt/android-viewbadger

对于Android,它不允许,因为它是在APK密封在程序编译的应用程序图标的改变。显示应用程序通知的方式仅在状态栏中。检查这些链接:http://developer.android.com/guide/topics/ui/notifiers/notifications.htmlhttp://e2eapps.com/2010/01/21/android-push-notification-system/

你想要显示的数字可以出现在状态栏中。

+0

我发现了三星note2上的徽章图标与TouchWiz 4.1.2和nexus 4与Android 4.2.2 – kvh

+0

我很好奇,Nexus 4 Android 4.2.2上的哪个应用程序。有这个功能吗? – ashatte

相关问题