【发布时间】:2014-07-12 09:02:17
【问题描述】:
我想问一下如何在通知栏中永久显示文本?
setTicker() 方法设置的代码在几秒钟后消失。
我的目标是在通知栏中显示当前温度。这样做的最佳解决方案是什么?也许有办法将文本传递给setSmallIcon() 方法?
这是我的通知代码:
NotificationCompat.Builder notBuilder = new NotificationCompat.Builder(getApplicationContext());
notBuilder.setContentText("text");
notBuilder.setContentTitle("title");
notBuilder.setSmallIcon(android.R.color.transparent);
notBuilder.setTicker("ticker");
notBuilder.setOngoing(true);
int notID = 8;
NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
nm.notify(notID, notBuilder.build());
(有没有更好的解决方案来隐藏小图标?这样是透明的,但仍然占位)
提前致谢!
【问题讨论】:
标签: android