gpt4 book ai didi

android - 如何在多个通知的状态栏中显示单个通知图标

转载 作者:行者123 更新时间:2023-11-29 15:04:45 25 4
gpt4 key购买 nike

我目前正在显示通知:

NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(this)
.setSound(sound)
.setSmallIcon(R.drawable.h)
.setLargeIcon(largeIcon)
.setContentTitle(title)
.setFullScreenIntent(pendingIntent,true)
.setContentText(message)
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(message))
.setAutoCancel(true)
.setPriority(Notification.PRIORITY_HIGH)
.setContentIntent(pendingIntent);

最佳答案

使用setGroup()在组中显示通知的键。

final static String GROUP_KEY_EMAILS = "group_key_emails";

// Build the notification, setting the group appropriately
Notification notif = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender1)
.setContentText(subject1)
.setSmallIcon(R.drawable.new_mail)
.setGroup(GROUP_KEY_EMAILS)
.build();

// Issue the notification
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(this);
notificationManager.notify(notificationId1, notif);

设置setGroupSummary()为一组通知设置摘要

关于android - 如何在多个通知的状态栏中显示单个通知图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38909803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com