小编Jeo*_*rge的帖子

换行符在通知 android studio 中不起作用

我正在尝试使用 .setContentText() 中的换行符发出通知,但这不起作用。

我的通知的生成器

builder.setContentTitle("Notification")               
                .setSmallIcon(R.drawable.notif)
                .setContentText("Example1 "+"\n"+" Example2")  
                .setDefaults(Notification.DEFAULT_ALL)
                .setAutoCancel(true)
                .setContentIntent(contentIntent)
                .setTicker("testing it")
                .setVibrate(new long[]{100, 200, 300, 400, 500, 400, 300, 200, 400})
                .setPriority(Notification.PRIORITY_HIGH);
Run Code Online (Sandbox Code Playgroud)

在通知中: Example1 Example2

但是我需要

 Example1
 Example2
Run Code Online (Sandbox Code Playgroud)

notifications android android-notifications android-studio

2
推荐指数
1
解决办法
1764
查看次数