2013-10-09 42 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

相關問題