Android的 - 增量状态栏通知图标 [英] Android - incremental status bar notification icon

查看:109
本文介绍了Android的 - 增量状态栏通知图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您知道我说的是:例如,当你得到多个新的电子邮件,在状态栏上的通知图标增加了一个小的红色圆圈,其中包含未读邮件的数量。 Twitroid有相同的图标。任何想法如何做?我不认为(或者我希望如此),有10000类似的图标。难道这红圈产生重叠通知图标?如果是这样的 - 任何code段将大大AP preciated

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. Any idea how it's done? I don't think (or so I hope) there are 10000 similar icons. Is this red circle generated and overlaid the notification icon? If so - any code snippets will be much appreciated.

推荐答案

这一个是好的,很容易,只需更改<一href="http://developer.android.com/reference/android/app/Notification.html#number"><$c$c>Notification.number到任何数量要出现在您的通知,如:

This one is nice and easy, just change Notification.number to whatever number you want to appear on your Notification, e.g.:

Notification notification = new Notification(icon, tickerText, when);
notification.number = 4;

这篇关于Android的 - 增量状态栏通知图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆