Customize component appearance using XML theme attributes or programmatic setter methods to match your app’s brand.
The UI Kit supports two approaches to styling: XML theme attributes for declarative, app-wide theming, and programmatic setters for runtime customization.
Programmatic setters take precedence over XML theme attributes when both are applied to the same property.
Each component exposes setter methods for its own style and sub-component styles. Using CometChatConversations as an example:
Method
Applies To
setStyle(@StyleRes int)
The component’s own style
setAvatarStyle(@StyleRes int)
Avatar sub-component
setBadgeStyle(@StyleRes int)
Unread badge sub-component
setReceiptStyle(@StyleRes int)
Message receipt icons
setTypingIndicatorStyle(@StyleRes int)
Typing indicator
setMentionsStyle(@StyleRes int)
Mentions formatting
setStatusIndicatorStyle(@StyleRes int)
Online/offline status indicator
setDateStyle(@StyleRes int)
Date/time label
Kotlin
Java
val conversations = CometChatConversations(context)conversations.setStyle(R.style.CustomConversationsStyle)conversations.setAvatarStyle(R.style.CustomAvatarStyle)conversations.setBadgeStyle(R.style.CustomBadgeStyle)
CometChatConversations conversations = new CometChatConversations(context);conversations.setStyle(R.style.CustomConversationsStyle);conversations.setAvatarStyle(R.style.CustomAvatarStyle);conversations.setBadgeStyle(R.style.CustomBadgeStyle);