Overview
Message bubbles are the core visual element in chat applications. Customizing them allows you to create a consistent user experience that aligns with your app’s theme.
This guide covers how to style Base Message Bubbles (the container) and Specific Message Types (Text, Image, Audio, etc.). Customization options include adjusting the background color, text appearance, and bubble shape to differentiate between incoming and outgoing messages.
Styling Architecture
To style message bubbles effectively without duplicating code, understand this inheritance hierarchy.
All code in this guide belongs in res/values/themes.xml.
AppTheme: The root theme of your application.
Message Bubble Styles: Acts as a central hub for all incoming/outgoing message styles. Linked directly to the AppTheme.
Specific Bubble Styles: Targets specific message types (e.g., Text, Video, Audio). These are linked inside the Message Bubble Styles.
Global Setup
Define this once in your res/values/themes.xml. All subsequent custom bubble styles will be routed through these hubs.
<!-- 1. Central Hub for Incoming Messages -->
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatMessageBubbleBackgroundColor">#FEEDE1</item>
<!-- Specific Incoming styles (Text, Image, etc.) will be added here -->
</style>
<!-- 2. Central Hub for Outgoing Messages -->
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatMessageBubbleBackgroundColor">#F76808</item>
<!-- Specific Outgoing styles (Text, Image, etc.) will be added here -->
</style>
<!-- 3. Connect the Hubs to your App Theme -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
<item name="cometchatIncomingMessageBubbleStyle">@style/CustomIncomingMessageBubbleStyle</item>
<item name="cometchatOutgoingMessageBubbleStyle">@style/CustomOutgoingMessageBubbleStyle</item>
</style>
Attribute references:
Core Message Bubbles
The following sections define how to style specific types of messages. Define the custom style, then link it to the central hubs (CustomIncomingMessageBubbleStyle or CustomOutgoingMessageBubbleStyle) established above.
Text Bubble
Text bubbles display plain text messages. These are the most common bubble type.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingTextBubbleStyle" parent="CometChatIncomingTextBubbleStyle">
<item name="cometchatTextBubbleBackgroundColor">#FEEDE1</item>
</style>
<!-- Link to Hub -->
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatTextBubbleStyle">@style/CustomIncomingTextBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingTextBubbleStyle" parent="CometChatOutgoingTextBubbleStyle">
<item name="cometchatTextBubbleBackgroundColor">#F76808</item>
</style>
<!-- Link to Hub -->
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatTextBubbleStyle">@style/CustomOutgoingTextBubbleStyle</item>
</style>
Attribute reference:
Link Preview Bubble
Displays a preview of links shared in messages, enriching the experience with titles, descriptions, and images.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingTextBubbleStyle" parent="CometChatIncomingTextBubbleStyle">
<item name="cometchatTextBubbleBackgroundColor">#FEEDE1</item>
<item name="cometchatTextBubbleLinkPreviewBackgroundColor">#FBAA75</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingTextBubbleStyle" parent="CometChatOutgoingTextBubbleStyle">
<item name="cometchatTextBubbleBackgroundColor">#F76808</item>
<item name="cometchatTextBubbleLinkPreviewBackgroundColor">#FBAA75</item>
</style>
Image Bubble
Image bubbles display images shared within a conversation.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingImageBubbleStyle" parent="CometChatIncomingImageBubbleStyle">
<item name="cometchatImageBubbleBackgroundColor">#FEEDE1</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatImageBubbleStyle">@style/CustomIncomingImageBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingImageBubbleStyle" parent="CometChatOutgoingImageBubbleStyle">
<item name="cometchatImageBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatImageBubbleStyle">@style/CustomOutgoingImageBubbleStyle</item>
</style>
Attribute reference:
Video Bubble
Video bubbles display video messages or clips in a chat.
Customization
<!-- INCOMING -->
<style name="CustomIncomingVideoBubbleStyle" parent="CometChatIncomingVideoBubbleStyle">
<item name="cometchatVideoBubbleBackgroundColor">#FEEDE1</item>
<item name="cometchatVideoBubblePlayIconTint">#F76808</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatVideoBubbleStyle">@style/CustomIncomingVideoBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingVideoBubbleStyle" parent="CometChatOutgoingVideoBubbleStyle">
<item name="cometchatVideoBubbleBackgroundColor">#F76808</item>
<item name="cometchatVideoBubblePlayIconTint">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatVideoBubbleStyle">@style/CustomOutgoingVideoBubbleStyle</item>
</style>
Attribute reference:
Audio Bubble
Audio bubbles represent audio messages or voice recordings.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingAudioBubbleStyle" parent="CometChatIncomingAudioBubbleStyle">
<item name="cometchatAudioBubbleAudioWaveColor">#F76808</item>
<item name="cometchatAudioBubblePlayIconTint">#F76808</item>
<item name="cometchatAudioBubblePauseIconTint">#F76808</item>
<item name="cometchatAudioBubbleBackgroundColor">#FEEDE1</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatAudioBubbleStyle">@style/CustomIncomingAudioBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingAudioBubbleStyle" parent="CometChatOutgoingAudioBubbleStyle">
<item name="cometchatAudioBubblePlayIconTint">#F76808</item>
<item name="cometchatAudioBubblePauseIconTint">#F76808</item>
<item name="cometchatAudioBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatAudioBubbleStyle">@style/CustomOutgoingAudioBubbleStyle</item>
</style>
Attribute reference:
File Bubble
Displays shared files, such as documents, PDFs, or spreadsheets.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingFileBubbleStyle" parent="CometChatIncomingFileBubbleStyle">
<item name="cometchatFileBubbleBackgroundColor">#FEEDE1</item>
<item name="cometchatFileBubbleFileDownloadIconTint">#F76808</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatFileBubbleStyle">@style/CustomIncomingFileBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingFileBubbleStyle" parent="CometChatOutgoingFileBubbleStyle">
<item name="cometchatFileBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatFileBubbleStyle">@style/CustomOutgoingFileBubbleStyle</item>
</style>
Attribute reference:
Sticker Bubble
Displays visual stickers shared in a conversation.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingStickerBubbleStyle" parent="CometChatStickerBubbleStyle">
<item name="cometchatStickerBubbleBackgroundColor">#FEEDE1</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatStickerBubbleStyle">@style/CustomIncomingStickerBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingStickerBubbleStyle" parent="CometChatStickerBubbleStyle">
<item name="cometchatStickerBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatStickerBubbleStyle">@style/CustomOutgoingStickerBubbleStyle</item>
</style>
Attribute reference:
Poll Bubble
Displays polls, options, and live results.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingPollBubbleStyle" parent="CometChatIncomingPollBubbleStyle">
<item name="cometchatPollBubbleBackgroundColor">#FEEDE1</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatPollBubbleStyle">@style/CustomIncomingPollBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingPollBubbleStyle" parent="CometChatOutgoingPollBubbleStyle">
<item name="cometchatPollBubbleBackgroundColor">#F76808</item>
<item name="cometchatPollBubbleProgressBackgroundColor">#FBAA75</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatPollBubbleStyle">@style/CustomOutgoingPollBubbleStyle</item>
</style>
Attribute reference:
Collaborative Bubble
Displays collaborative content, such as shared documents or tasks.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingCollaborativeBubbleStyle" parent="CometChatIncomingCollaborativeBubbleStyle">
<item name="cometchatCollaborativeBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatCollaborativeBubbleStyle">@style/CustomIncomingCollaborativeBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingCollaborativeBubbleStyle" parent="CometChatOutgoingCollaborativeBubbleStyle">
<item name="cometchatCollaborativeBubbleBackgroundColor">#F76808</item>
<item name="cometchatCollaborativeBubbleSeparatorColor">#FBAA75</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatCollaborativeBubbleStyle">@style/CustomOutgoingCollaborativeBubbleStyle</item>
</style>
Attribute reference:
Meet Call Bubble
Displays call-related actions and statuses in the chat interface.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingMeetCallBubbleStyle" parent="CometChatIncomingMeetCallBubbleStyle">
<item name="cometchatMeetCallBubbleBackgroundColor">#FBAA75</item>
<item name="cometchatMeetCallBubbleCallIconTint">#F76808</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatMeetCallBubbleStyle">@style/CustomIncomingMeetCallBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingMeetCallBubbleStyle" parent="CometChatOutgoingMeetCallBubbleStyle">
<item name="cometchatMeetCallBubbleBackgroundColor">#F76808</item>
<item name="cometchatMeetCallBubbleSeparatorColor">#FBAA75</item>
<item name="cometchatMeetCallBubbleCallIconTint">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatMeetCallBubbleStyle">@style/CustomOutgoingMeetCallBubbleStyle</item>
</style>
Attribute reference:
Delete Bubble
Indicates a message that has been removed by the sender.
Default & Customization
<!-- INCOMING -->
<style name="CustomIncomingDeleteBubbleStyle" parent="CometChatIncomingDeleteBubbleStyle">
<item name="cometchatMessageBubbleBackgroundColor">#FBAA75</item>
</style>
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatDeleteBubbleStyle">@style/CustomIncomingDeleteBubbleStyle</item>
</style>
<!-- OUTGOING -->
<style name="CustomOutgoingDeleteBubbleStyle" parent="CometChatOutgoingDeleteBubbleStyle">
<item name="cometchatMessageBubbleBackgroundColor">#F76808</item>
</style>
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatDeleteBubbleStyle">@style/CustomOutgoingDeleteBubbleStyle</item>
</style>
Attribute reference:
List-Level Bubbles & Special Features
Unlike standard messages, Call Action and Action bubbles are tied to the Message List Style, not the Incoming/Outgoing Hubs. AI Assistants and Quoted Replies have specialized formatting.
Call Action Bubble
Displays call actions like missed calls within the message list.
Default & Customization
<!-- 1. Define the Style -->
<style name="CustomCallActionBubbleStyle" parent="CometChatCallActionBubbleStyle">
<item name="cometchatCallActionBubbleBackgroundColor">#FEEDE1</item>
<item name="cometchatCallActionBubbleStrokeWidth">@dimen/cometchat_1dp</item>
<item name="cometchatCallActionBubbleStrokeColor">#F76808</item>
<item name="cometchatCallActionBubbleTextColor">#F76808</item>
<item name="cometchatCallActionBubbleIconTint">#F76808</item>
<item name="cometchatCallActionBubbleMissedCallBackgroundColor">#FEEDE1</item>
<item name="cometchatCallActionBubbleMissedCallIconTint">#F76808</item>
<item name="cometchatCallActionBubbleMissedCallTextColor">#F76808</item>
</style>
<!-- 2. Apply it to the Message List Style -->
<style name="CustomCometChatMessageListStyle" parent="CometChatMessageListStyle">
<item name="cometchatMessageListCallActionBubbleStyle">@style/CustomCallActionBubbleStyle</item>
</style>
<!-- 3. Connect to AppTheme -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
<item name="cometchatMessageListStyle">@style/CustomCometChatMessageListStyle</item>
</style>
Attribute references:
Action Bubble
Displays global group actions (e.g., “User joined the chat”).
Default & Customization
<!-- 1. Define the Style -->
<style name="CustomActionBubbleStyle" parent="CometChatActionBubbleStyle">
<item name="cometchatActionBubbleBackgroundColor">#FEEDE1</item>
<item name="cometchatActionBubbleStrokeWidth">@dimen/cometchat_1dp</item>
<item name="cometchatActionBubbleStrokeColor">#F76808</item>
<item name="cometchatActionBubbleTextColor">#F76808</item>
</style>
<!-- 2. Apply it to the Message List Style -->
<style name="CustomCometChatMessageListStyle" parent="CometChatMessageListStyle">
<item name="cometchatMessageListActionBubbleStyle">@style/CustomActionBubbleStyle</item>
</style>
<!-- 3. Connect to AppTheme -->
<style name="AppTheme" parent="CometChatTheme.DayNight">
<item name="cometchatMessageListStyle">@style/CustomCometChatMessageListStyle</item>
</style>
Attribute reference:
AI Assistant Bubble
Styles interactions generated by the AI assistant. These are anchored to the IncomingMessageBubbleStyle.
Default & Customization
<!-- Define AI Font (Optional) -->
<style name="TextStyleTimesNewRoman">
<item name="android:fontFamily">@font/times_new_roman_regular</item>
</style>
<!-- Define AI Bubble -->
<style name="CustomAIAssistantBubbleStyle">
<item name="cometChatAIAssistantBubbleBackgroundColor">@color/cometchat_color_transparent</item>
<item name="cometChatAIAssistantBubbleTextAppearance">@style/TextStyleTimesNewRoman</item>
<item name="cometChatAIAssistantBubbleTextColor">?attr/cometchatTextColorPrimary</item>
</style>
<!-- Link to Hub -->
<style name="CustomIncomingMessageBubbleStyle" parent="CometChatIncomingMessageBubbleStyle">
<item name="cometchatAIAssistantBubbleStyle">@style/CustomAIAssistantBubbleStyle</item>
</style>
Attribute reference:
Quoted Reply
Styles the preview block when a user replies to a specific message.
<!-- Define Reply Fonts -->
<style name="TimesNewRoman">
<item name="android:fontFamily">@font/times_new_roman_regular</item>
</style>
<style name="CustomOutgoingMessageDateStyle">
<item name="cometchatDateTextAppearance">@style/TimesNewRoman</item>
<item name="cometchatDateTextColor">@color/white</item>
</style>
<!-- Define Message Preview (The Quote itself) -->
<style name="CustomMessagePreviewStyle">
<item name="cometChatMessagePreviewBackgroundColor">#ea6d71</item>
<item name="cometChatMessagePreviewTitleTextAppearance">@style/TimesNewRoman</item>
<item name="cometChatMessagePreviewSubtitleTextAppearance">@style/TimesNewRoman</item>
</style>
<!-- Define Text Style inside the Reply -->
<style name="CustomTextBubbleStyle">
<item name="cometchatTextBubbleTextColor">@color/white</item>
<item name="cometchatTextBubbleTextAppearance">@style/TimesNewRoman</item>
</style>
<!-- Define Wrapper Attributes & Link Preview to Outgoing Hub -->
<style name="CustomOutgoingMessageBubbleStyle" parent="CometChatOutgoingMessageBubbleStyle">
<item name="cometchatMessageBubbleBackgroundColor">#e54a4b</item>
<item name="cometchatMessageBubbleCornerRadius">@dimen/cometchat_radius_3</item>
<item name="cometchatTextBubbleStyle">@style/CustomTextBubbleStyle</item>
<item name="cometchatMessageBubbleDateStyle">@style/CustomOutgoingMessageDateStyle</item>
<item name="cometChatMessagePreviewStyle">@style/CustomMessagePreviewStyle</item>
</style>
Attribute reference: