是否可以在同一通知中同时使用InboxStyle和BigText

德罗约克

我创建了一个通知

NotificationCompat.InboxStyle

并使用添加文字

inboxStyle.addLine

多条短信。但是,当我添加

Notification.BigTextStyle

在通知中,BigTextStyle由于已有通知而无法正常工作setStyle

我的通知是;

Notification summaryNotification = new
NotificationCompat.Builder(this, notificationChannelId)
                    .setContentTitle("title")
                    .setStyle(addInboxStyle())
                    .setStyle(addBigTextStyle())
                    .setGroupSummary(true)
                    .setContentIntent(pendingIntent)
                    .setChannelId(notificationChannelId)
                    .build();
hvar90

否,不可能,但是使用MessagingStyle通知可以得到类似的行为,可以使用大消息而无需扩展和扩展通知,并且通知中可以包含多行

https://developer.android.com/reference/android/app/Notification.MessagingStyle

NotificationCompat.MessagingStyle.Message message1 =
        new NotificationCompat.MessagingStyle.Message(messages[0].getText(),
                                                      messages[0].getTime(),
                                                      messages[0].getSender());
NotificationCompat.MessagingStyle.Message message2 =
        new NotificationCompat.MessagingStyle.Message(messages[1].getText(),
                                                      messages[1].getTime(),
                                                      messages[1].getSender());

Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
        .setSmallIcon(R.drawable.new_message)
        .setStyle(new NotificationCompat.MessagingStyle(resources.getString(R.string.reply_name))
                .addMessage(message1)
                .addMessage(message2))
        .build();

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

从对象中的值生成唯一通知

是否可以确保为同一通道的同一线程调用channelActive和channelRead?

在select中的同一通道上读写

是否可以在同一方法中同时使用GET和POST?

Laravel 5.3-用户集合的单一通知(追随者)

是否可以使用Apache POI在同一工作表中同时创建冻结窗格和拆分窗格?

.NET-是否可以在同一对象中同时使用XmlAnyElementAttribute和XmlSerializer.UnknownElement事件

使用超级账本结构在同一通道上部署多个链码

Azure通知中心是否可以在一个请求中同时在SANDBOX和PRODUCTION中发送推送通知?

多个 Go 例程从同一通道读取

在64位Linux中,是否可以在同一可执行文件中同时使用64位和32位指令?

我可以在同一系统中同时使用内部和外部图形卡吗?

可以在同一Java版本中同时使用Maven和Gradle吗?

在同一事务中同时使用 EntityManager 和 Spring Repository 时是否存在性能问题?

是否可以在Hibernate的同一项目中同时使用批注和hbm.xml文件?

如何在标准输出(Windows cmd)的同一通道中打印迭代的字符串?

如何使用Hyperledger composer在同一通道上配置两个P2P节点?

在Spring Boot中是否可以对同一模型使用MongoDb和PostgreSql?

是否可以在Eclipse中同时使用CDT和Java IDE?

是否可以在模块中同时使用NgxUiLoaderHttpModule和NgxUiLoaderRouterModule。ts?

是否可以在属性定义中同时使用“新”和“替代”?

是否可以在 sed 中同时使用选项 -i 和 -E?

是否可以在 CSS 中同时使用 vw 和 vh?

我是否可以通过同一UDP套接字同时发送和接收数据

是否可以在同一接口上同时配置pppoe和dhcp?

我们可以在同一个应用程序中同时使用MongoRepository和MongoTemplate吗

我可以在同一Spring应用程序中同时使用JDBC和R2DBC吗?

“ AND”和“ OR”是否可以在同一查询中使用?

两个例程在同一通道上进行通信