首页 > 解决方案 > 将文本显示为通知图标

问题描述

我正在尝试向将计数器显示为图标而不是实际图标的用户显示通知。

这就是我想要实现的目标

在此处输入图像描述

到目前为止我尝试过的

int myCounter = 0;
setSmallIcon(myCounter); // actually the notification won't even display if its not an actual icon
setTickerText(String.valueOf(myCounter)); // This is actualy something different
setLargeIcon(myBitmapWithText); // I also tried generating a bitmap with text, but it won't display since the resource needs to be in the app-package itself

根据我的阅读,我可以使用一个AnimatedDrawable但它真的不合逻辑来创建 50 个不同的可绘制对象来完成该任务,除非我没有其他选择:)

我对此一无所知,我怎样才能达到上述结果?

标签: androidandroid-notifications

解决方案


推荐阅读