我想在通知栏中滚动文本标题,数据来自应用程序内部。
NotificationCompat.Builder builder=new NotificationCompat.Builder(this,channel);
builder.setContentTitle(data);
Notification notification=builder.build();
NotificationManagerCompat.from(this).notify(0,notification);
答案 0 :(得分:0)
您可以将bigText用于可滚动的长文本。 longText 将是可滚动的文本。
NotificationCompat.Builder builder=new NotificationCompat.Builder(this,channel);
builder.setContentTitle(data);
builder.setStyle(new Notification.BigTextStyle()
.bigText(longText))
Notification notification=builder.build();
NotificationManagerCompat.from(this).notify(0,notification);
查看此链接以获取更多详细信息:Click here