
我试图在通知中使用BigTextStyle显示多行文本,但无法这样做.我正在使用下面的代码.
public voID sendNotification(VIEw vIEw) { String msgText = "Jeally Bean Notification example!! " + "where you will see three different kind of notification. " + "you can even put the very long string here."; notificationmanager notificationmanager = getnotificationmanager(); PendingIntent pi = getPendingIntent(); androID.app.Notification.Builder builder = new Notification.Builder( this); builder.setContentTitle("Big text Notofication") .setContentText("Big text Notification") .setSmallicon(R.drawable.ic_launcher).setautoCancel(true) .setPriority(Notification.PRIORITY_HIGH) .addAction(R.drawable.ic_launcher,"show activity",pi); Notification notification = new Notification.BigTextStyle(builder) .bigText(msgText).build(); notificationmanager.notify(0,notification);}public notificationmanager getnotificationmanager() { return (notificationmanager) getSystemService(NOTIFICATION_SERVICE);}public PendingIntent getPendingIntent() { return PendingIntent.getActivity(this,new Intent(this,MainActivity.class),0);}我甚至无法在通知中看到’msgText’.知道为什么吗?
谢谢你的帮助.最佳答案解决了!
代码很好,只是没有足够的空间进行大通知.当我断开数据线时,它以所需的方式显示. 总结
以上是内存溢出为你收集整理的Android:无法在通知中显示多行文本全部内容,希望文章能够帮你解决Android:无法在通知中显示多行文本所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)