通知文本太长,无法显示全文

Ana*_*eza 9 notifications android

我正在为android 2.3.3开发一个应用程序.我正在显示通知,但此通知的文字太长,并且没有显示全文及其被删除,因此如何在通知中显示我的全文?

这是代码:

String message = "Tonights Taraweeh consists of Alif Lam Mim and the first quarter of Sayaqul. The Surahs covered are Al-Fatiha(The Opening),and the first two-thirds of Al-Baqara(The Cow).";
Notification notification = new Notification();
notification.setLatestEventInfo(context, title, message, contentIntent);
Run Code Online (Sandbox Code Playgroud)

Pel*_*nes 5

扩展通知仅适用于Android 4.1,请阅读此处

Android 2.3.3使用旧的通知而不扩展.您必须使用较短的文本,剪切文本(并在用户单击时显示完整文本)或在您在Android 4.1或更早版本中显示通知时调整文本.


AZ_*_*AZ_ 5

我短你必须设置BigTextStyle

Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
            .setSmallIcon(R.drawable.new_mail)
            .setContentTitle(emailObject.getSenderName())
            .setContentText(emailObject.getSubject())
            .setLargeIcon(emailObject.getSenderAvatar())
            .setStyle(new NotificationCompat.BigTextStyle()
                    .bigText(__BigTextHere___))
            .build();
Run Code Online (Sandbox Code Playgroud)