Android通知动态图标 [英] Android Notification Dynamic Icon

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

问题描述

可以用一些text / int覆盖通知图标吗?或者是否可以在飞行中生成自定义图标?

Is it possible to overlay a notification icon with some text/int? or is it possible to generate a custom icon on the fly?

例如,我的通知中显示了当前图标,我希望能够显示例如红色框中的数字2。

For example I have the current icon displayed for my notification, I would like to be able to display for example the number 2 within the red box.

由于这不是通知的计数(所以不是红色的泡泡),所以设置通知中的号码将不起作用。

As this is not a count of notifications ( so not the red bubble ), the setting the "number" in the notification will not work.

我想为每个可能的数字创建一个单独的图标,我希望显示?还是有更好的方式实现这一点?

Will I have to just create an individual icon for every possible number I wish to display? Or is there a better way of achieving this?

推荐答案

尝试使用AnimationDrawable的。您可以使用它们将多个可绘图合成为一个,并选择要显示的。我真的认为,这是要走的路。

Try using AnimationDrawable's. You can use them to combine multiple drawables into a single one, and select the one you want to display. I really think, this is the way to go.

更多信息: AnimationDrawable

当然,您将不得不为您要显示的所有整数提供单独的绘图,但这样,您可以轻松地更改通知的外观。

Off course, you will have to provide individual drawables for all your Integers you want to display, but this way, you can easily change the appearance of your notifications

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

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