我已經能夠在Android模擬器上成功顯示通知號碼計數。但是,當我在實際的Android手機上使用它時,它不會顯示任何內容。關於爲什麼可能有區別的任何建議?Android通知欄號碼
回答
在我的情況下,這是手機的東西。這是一個令人難以置信的Droid。它不適用於android 2.1,但Verizon的2.2發佈解決了這個問題。
您能否提供您使用的代碼? – h4ck3d 2012-03-11 22:45:44
先嚐試用數字1設置它,然後再往上走。從這裏建議:http://developer.android.com/guide/topics/ui/notifiers/notifications.html
數場
該值指示由通知表示事件的當前數量。相應的編號覆蓋在狀態欄圖標的頂部。如果您打算使用此字段,則必須在首次創建通知時以「1」開頭。 (如果您在更新過程中從零值更改爲任何東西時,不顯示的數字。)
好!它適用於Android 2.1。 – 2011-08-31 13:58:47
(爲後人)
要闡述什麼Izkata說,如果你提出了一個通知,沒有「號碼」計數,然後您想要添加號碼,您需要取消現有通知並重新設置號碼字段集。 (「取消」是NotificationManager方法之一。)從0到數字不會顯示數字,除非您取消原始通知。
同樣,如果你有一個通知上的數字,並希望回到一個空白的通知,你需要取消當前一個,並重新沒有數字。從數字到0將只顯示沒有任何內容的小綠色泡泡。
請注意,如果您只想更改現有號碼,則可以使用新號碼重新發出通知 - 無需取消前一號碼。
我已經設置了一個通知,它使用'builder.setContentText(「Resumed」)更新。setNumber(7); notificationManger.notify(1,builder.build());'。我在通知抽屜中看到「已恢復」文本和數字「7」,但該號碼未顯示在通知欄圖標上。任何想法爲什麼? – 2015-03-18 21:59:38
其實,這個數字出現在一個氰基模式的平板電腦中,但不是在三星筆記4中,儘管兩者都使用了android 4.4.4。 – 2015-04-10 13:07:41
Take two global variable count, i;
public void createNotification(View view){
NotificationManager mNotificationManager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.logo,
"A new notification", System.currentTimeMillis());
// Hide the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;
Intent intent = new Intent(this,SampleJsonReadingActivity.class);
PendingIntent activity = PendingIntent.getActivity(this, 0, intent, 0);
notification.setLatestEventInfo(this, "This is the title",
"This is the text", activity);
if(count==1){
count ++;
}
else{
i++;
}
notification.number +=i;
mNotificationManager.notify(0, notification);
}
它爲我....
- 1. Android號碼通知
- 2. Android通知欄
- 3. Android:從通知欄中刪除通知
- 4. 從android通知欄中刪除通知
- 5. 號碼作爲通知的Android
- 6. Android狀態欄通知
- 7. Android WebView與通知欄
- 8. 從通知欄在Android的
- 9. 禁用android通知欄
- 10. 清除通知欄Android
- 11. Phonegap - Android - 狀態欄通知
- 12. jQuery通知欄
- 13. 通知欄
- 14. Android狀態欄通知 - 通過任何方式通知狀態欄(烤麪包)通過狀態欄?
- 15. Android - 簡單的代碼來啓用通知欄
- 16. 僅在通知欄中顯示Android運行代碼
- 17. 通知欄文本?使用編碼UI?
- 18. 如何禁用Android通知欄上的短信通知圖標?
- 19. Android的 - 保持通知持穩在通知欄
- 20. Android如何在通知欄上撰寫通知
- 21. Android的亮度變化通知(或狀態欄彙總通知)
- 22. 通知文本在Android的通知欄中不可見?
- 23. GCM通知不會顯示在通知欄中。 Android
- 24. 的Android無法隱藏通知欄
- 25. Android - 增量狀態欄通知圖標
- 26. 開始下載通知欄點擊android
- 27. 通知欄上的Android服務
- 28. Phonegap狀態欄通知,Android,iOS
- 29. 隱藏實體中的android通知欄
- 30. PhoneGap的Android狀態欄通知例如
什麼是通知數算? – Macarse 2010-06-15 02:54:40
http://developer.android.com/reference/android/app/Notification.html#number – JonF 2010-06-15 03:01:53
特別是哪款手機?我認爲有些人實際上忽略了這個功能。 – 2010-12-27 02:41:10