[英]How to break line content of notifications on Android
Iam使用PHP將通知推送到Android和iOS設備。 完美的作品。 但是通知不能在多行顯示。
我使用了'\\ n'字符,但是它只能在iOS上使用,而不能在Android上使用。
如何在Android設備上的多行顯示通知?
是的,Android通知不使用默認樣式的\\n
,您應該以普通模式(單行)設置文本,但是如果要在文本中使用\\n
,則應該設置NotificationCompat.BigTextStyle()
,
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(thisActivity)
.setSmallIcon(resourceDrowable)
.setContentTitle("My notification")
.setContentText("Hello World")
.setAutoCancel(true)
.setStyle(new NotificationCompat.BigTextStyle().bigText("My\nMessage"));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.