Sendbird Chat SDK provides expansive messaging features to enhance users' chat experience. Leveraging the messaging features of the SDK, our UIKit for Android allows you to tailor the appearance and feel of your chat interface to align with your app's branding or your specific requirements. This page walks you through customizing the message UI of the chat interface.
To create a new type of message rather than customizing, see our guide on how to add new message type.
The following table shows a list of message types available and its designated value. The values from 0 to 1000 are reserved for UIKit's predefined message types.
You can customize UI settings that apply to the entire message list using MessageListUIParams. Once you've created and customized the MessageListUIParams object, you can pass it to the MessageListAdapter when you create an instance of the adapter. This way, the custom settings will be applied to the message list.
val customMessageListUIParams = MessageListUIParams.Builder()
.setUseMessageGroupUI(false)
// You can also apply the configuration to all items.
/*
.setMessageGroupType()
.setChannelConfig()
.setUseMessageReceipt()
.setUseQuotedView()
.setUseReverseLayout()
*/
.build()
You can customize the text properties or background of the message UI using MessageUIConfig. Once you've created and customized the MessageUIConfig object, you can pass it to the MessageListAdapter when you create an instance of the adapter. This way, the custom settings will be applied to the message list.
Specifies the style of the text. The Typeface class provides: -Typeface.NORMAL: Standard text without any style. -Typeface.BOLD: Text in bold style. -Typeface.ITALIC: Text in italic style. -Typeface.BOLD_ITALIC: Text that is both bold and italicized.
textSize
Integer
Specifies the size of the text in pixels.
familyName
String
Specifies the font family for the text, such as "Arial", "Roboto", etc.
You can create a MessageUIConfig and set the TextUIConfig for the desired message types. Once you've created the MessageUIConfig, you can apply it to the Adapter to reflect the changes.
CustomMessageListAdapter(channel, uiParams).apply {
this.messageUIConfig = MessageUIConfig().apply {
val textUIConfig = TextUIConfig.Builder()
.setTextColor(Color.RED)
// You can also apply the configuration to all items.
/*
.setTextBackgroundColor()
.setTextSize()
.setTextStyle()
.setFamilyName()
.setCustomFontRes()
*/
.build()
this.myMessageTextUIConfig.apply(textUIConfig)
this.otherMessageTextUIConfig.apply(textUIConfig)
// You can also apply the configuration to each item.
/*
this.myMessageBackground = null
this.myEditedTextMarkUIConfig.apply(textUIConfig)
this.myMentionUIConfig.apply(textUIConfig)
this.myNicknameTextUIConfig.apply(textUIConfig)
this.linkedTextColor = null
this.myOgtagBackground = null
this.myReactionListBackground = null
this.mySentAtTextUIConfig.apply(textUIConfig)
this.operatorNicknameTextUIConfig.apply(textUIConfig)
this.otherEditedTextMarkUIConfig.apply(textUIConfig)
this.otherMentionUIConfig.apply(textUIConfig)
this.otherMessageBackground = null
this.otherNicknameTextUIConfig.apply(textUIConfig)
this.otherOgtagBackground = null
this.otherReactionListBackground = null
this.otherSentAtTextUIConfig.apply(textUIConfig)
this.repliedMessageTextUIConfig.apply(textUIConfig)
*/
}
}
You can either overwrite an existing style with new definitions, or you can choose to inherit from an existing style and only modify certain attributes as needed. Before applying the changes, you need to create a custom style first as shown below.