[英]Android - incremental status bar notification icon
You know what I'm talking about: for example when you get multiple new emails the notification icon in the status bar is augmented with a little red circle that contains number of unread mails. 您知道我在说什么:例如,当您收到多封新电子邮件时,状态栏中的通知图标会增加一个包含未读邮件数量的小红圈。 Twitroid has the same icon.
Twitroid有相同的图标。 Any idea how it's done?
知道它是如何完成的吗? I don't think (or so I hope) there are 10000 similar icons.
我不认为(或者我希望)有10000个相似的图标。 Is this red circle generated and overlaid the notification icon?
这个红色圆圈是否生成并覆盖了通知图标? If so - any code snippets will be much appreciated.
如果是这样 - 任何代码片段将非常感激。
This one is nice and easy, just change Notification.number
to whatever number you want to appear on your Notification, eg: 这个很简单,只需将
Notification.number
更改为您希望在通知中显示的任何数字,例如:
Notification notification = new Notification(icon, tickerText, when);
notification.number = 4;
A good example of how to use the notification bar can be found in this tutorial: 在本教程中可以找到如何使用通知栏的一个很好的示例:
http://www.firstdroid.com/2010/05/09/learn-by-example-using-notification-bar/ http://www.firstdroid.com/2010/05/09/learn-by-example-using-notification-bar/
Hope it helps, Adrian. 希望它有所帮助,阿德里安。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.