跳到主要内容
新版 Web IMKit SDKWeb IMKit SDK 从 5.36.0 版本开始升级了 UI 和 SDK 结构。如果您集成的版本低于 5.36.0,请参考旧版 Web IMKit 文档

消息气泡

Web IMKit 提供了自定义消息气泡的能力,以满足业务层对消息气泡的定制化需求。

定制化消息气泡

IRCKitMessageBubbleCfg 提供以下属性:

配置项类型默认值说明
radiusNumber20气泡圆角半径。
layoutRCKitBubbleLayoutRCKitBubbleLayout.LEFT_RIGHT气泡布局方式。有效值为 RCKitBubbleLayout.LEFT_RIGHT (左右布局)、RCKitBubbleLayout.LEFT_JUSTIFYING (靠左对齐)。
backgroundColorForMyselfString/Number#D2E1FE自己发送的消息气泡背景色。
backgroundColorForOthersString/Number#F3F5FA其他人发送的消息气泡背景色。
textColorForMyselfString/Number#020814自己发送的消息气泡文字颜色。
textColorForOthersString/Number#020814其他人发送的消息气泡文字颜色。
showMyProfileInPrivateConversationBooleantrue在单聊会话中,是否显示自己的头像。
showMyNameInPrivateConversationBooleanfalse在单聊会话中,是否显示自己的名称。
showMyProfileInGroupConversationBooleantrue在群聊会话中,是否显示自己的头像。
showMyNameInGroupConversationBooleanfalse在群聊会话中,是否显示自己的名称。
showOthersProfileInPrivateConversationBooleantrue在单聊会话中,是否显示他人的头像。
showOthersNameInPrivateConversationBooleanfalse在单聊会话中,是否显示他人的名称。
showOthersProfileInGroupConversationBooleantrue在群聊会话中,是否显示他人的头像。
showOthersNameInGroupConversationBooleantrue在群聊会话中,是否显示他人的名称。

获取当前气泡配置

JavaScript
const config = kitApp.cloneMessageBubbleCfg();

更新气泡配置

提示

更新气泡配置仅限于 kitApp.ready() 调用前有效。

JavaScript
kitApp.setMessageBubbleCfg(config);