消息气泡
Global IM UIKit 提供了自定义消息气泡的能力,以满足业务层对消息气泡的定制化需求。
定制化消息气泡
IRCKitMessageBubbleCfg 提供以下属性:
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| radius | Number | 8 | 气泡圆角半径。 |
| layout | RCKitBubbleLayout | RCKitBubbleLayout.LEFT_RIGHT | 气泡布局方式。有效值为 RCKitBubbleLayout.LEFT_RIGHT (左右布局)、RCKitBubbleLayout.LEFT_JUSTIFYING (靠左对齐)。 |
| backgroundColorForMyself | Number | 0x0099FF | 自己发送的消息气泡背景色。 |
| backgroundColorForOthers | Number | 0xFFFFFF | 其他人发送的消息气泡背景色。 |
| textColorForMyself | Number | 0xFFFFFF | 自己发送的消息气泡文字颜色。 |
| textColorForOthers | Number | 0x000000 | 其他人发送的消息气泡文字颜色。 |
| showMyProfileInPrivateConversation | Boolean | true | 在单聊会话中,是否显示自己的头像。 |
| showMyNameInPrivateConversation | Boolean | true | 在单聊会话中,是否显示自己的名称。 |
| showMyProfileInGroupConversation | Boolean | true | 在群聊会话中,是否显示自己的头像。 |
| showMyNameInGroupConversation | Boolean | true | 在群聊会话中,是否显示自己的名称。 |
| showOthersProfileInPrivateConversation | Boolean | true | 在单聊会话中,是否显示他人的头像。 |
| showOthersNameInPrivateConversation | Boolean | true | 在单聊会话中,是否显示他人的名称。 |
| showOthersProfileInGroupConversation | Boolean | true | 在群聊会话中,是否显示他人的头像。 |
| showOthersNameInGroupConversation | Boolean | true | 在群聊会话中,是否显示他人的名称。 |
获取当前气泡配置
JavaScript
const config = kitApp.cloneMessageBubbleCfg();
更新气泡配置
提示
更新气泡配置仅限于 kitApp.ready() 调用前有效。
JavaScript
kitApp.setMessageBubbleCfg(config);