我從谷歌搜索,發現了幾個答案。有人說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