通知多行 [英] Notification multiline
本文介绍了通知多行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何制作长通知多行.我正在使用下面的代码片段,但它不起作用:
How to make a long notification multiline. I am using the below code snippet but its not working:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setContentTitle(title)
.setSmallIcon(R.drawable.icon)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setContentText(message)
.setContentIntent(pIntent);
return mBuilder.build();
推荐答案
添加此内容:
NotificationCompat.Builder builder = new NotificationCompat.Builder(
context);
Notification notification = builder.setContentIntent(contentIntent)
.setSmallIcon(icon).setTicker(appname).setWhen(0)
.setAutoCancel(true).setContentTitle(appname)
.setStyle(new NotificationCompat.BigTextStyle().bigText(message))
.setContentText(message).build();
notificationManager.notify(0, notification);
还请检查:多行通知
这篇关于通知多行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文