如何在通知中设置文本 [英] How to set Text in Notification
问题描述
如何设置通知的此文本行.我用来模拟图像中内容的代码是 通知通知 = new NotificationCompat.Builder(context).setSmallIcon(R.drawable.ic_launcher).setContentTitle("迈克尔").setContentText("今晚吃晚饭?").setSubText("我们去吃晚饭吧,你有空吗?").setLargeIcon(myBitMap).addAction(R.drawable.ic_archive, "ARCHIVE", null).addAction(R.drawable.ic_reply, "REPLY", null).build()
How can I set this text line of the notification. my code to simulate what is in the image is
Notification notification = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Michael")
.setContentText("Dinner tonight?")
.setSubText("let's grab some dinner.Are you free?")
.setLargeIcon(myBitMap)
.addAction(R.drawable.ic_archive, "ARCHIVE", null)
.addAction(R.drawable.ic_reply, "REPLY", null)
.build()
编辑
还是不行,我必须使用自定义视图?
or no way , I've to use custom view ?
推荐答案
答案在那个链接里https://developer.android.com/reference/android/support/v4/app/NotificationCompat.InboxStyle.html
这篇关于如何在通知中设置文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!