MessageHeader is a Component that showcases the User or Group details in the toolbar. Furthermore, it also presents a typing indicator and a back navigation button for ease of use.
The MessageHeader is comprised of the following components:
Actions dictate how a component functions. They are divided into two types: Predefined and User-defined. You can override either type, allowing you to tailor the behavior of the component to fit your specific needs.The MessageHeader component does not have any exposed actions.
Filters allow you to customize the data displayed in a list within a Component. You can filter the list based on your specific criteria, allowing for a more customized. Filters can be applied using RequestBuilders of Chat SDK.The MessageHeader component does not have any exposed filters.
Events are emitted by a Component. By using event you can extend existing functionality. Being global events, they can be applied in Multiple Locations and are capable of being Added or Removed.The MessageHeader component does not produce any events.
To fit your app’s design requirements, you can customize the appearance of the conversation component. We provide exposed methods that allow you to modify the experience and behavior according to your specific needs.
Using Style you can customize the look and feel of the component in your app, These parameters typically control elements such as the color, size, shape, and fonts used within the component.
1. MessageHeader Style
To customize the appearance, you can assign a MessageHeaderStyle object to the MessageHeader component.
Java
Kotlin
MessageHeaderStyle style = new MessageHeaderStyle();style.setTypingIndicatorTextColor(Color.parseColor("#ff0000"));messageHeader.setStyle(style);
val style = MessageHeaderStyle()style.typingIndicatorTextColor = Color.parseColor("#ff0000")messageHeader.setStyle(style)
The properties exposed by MessageHeaderStyle are as follows:
Property
Description
Code
Border Width
Used to set border
.setBorderWidth(int)
Border Color
Used to set border color
.setBorderColor(@ColorInt int)
Corner Radius
Used to set corner radius
.setCornerRadius(float)
Background
Used to set background colour
.setBackground(@ColorInt int)
Background
Used to set Drawable in background
.setBackground(@Drawable )
BackIcon Tint
Used to set back button icon tint
.setBackIconTint(@ColorInt int)
TypingIndicator TextAppearance
Used to set typing indicator textStyle
.setTypingIndicatorTextAppearance(@StyleRes int)
TypingIndicator TextColor
Used to set typing indicator text color
.setTypingIndicatorTextColor(@ColorInt int)
SubtitleText Appearance
Used to set subtitle text style
.setSubtitleTextAppearance(@StyleRes int)
SubtitleText Color
Used to set subtitle text color
.setSubtitleTextColor(@ColorInt int)
OnlineStatus Color
Used to set online status colour
.setOnlineStatusColor(@ColorInt int)
2. Avatar Style
If you want to apply customized styles to the Avatar component within the MessageHeader Component, you can use the following code snippet. For more information you can refer Avatar Styles.
Java
Kotlin
AvatarStyle avatarStyle = new AvatarStyle();avatarStyle.setBorderWidth(10);avatarStyle.setBorderColor(Color.BLACK);messageHeader.setAvatarStyle(avatarStyle);
val avatarStyle = AvatarStyle()avatarStyle.borderWidth = 10avatarStyle.borderColor = Color.BLACKmessageHeader.setAvatarStyle(avatarStyle)
3. ListItem Style
If you want to apply customized styles to the ListItemStyle component within the MessageHeader Component, you can use the following code snippet. For more information, you can refer ListItem Styles.
Java
Kotlin
ListItemStyle listItemStyle = new ListItemStyle();listItemStyle.setTitleColor(Color.BLACK);messageHeader.setListItemStyle(listItemStyle);
val listItemStyle = ListItemStyle()listItemStyle.setTitleColor(Color.BLACK)messageHeader.setListItemStyle(listItemStyle)
4. StatusIndicator Style
If you want to apply customized styles to the Status Indicator component within the MessageHeader Component, you can use the following code snippet. For more information you can refer StatusIndicator Styles.
Java
Kotlin
StatusIndicatorStyle statusIndicatorStyle = new StatusIndicatorStyle(); statusIndicatorStyle.setCornerRadius(3.5f); statusIndicatorStyle.setBorderColor(Color.GREEN); messageHeader.setStatusIndicatorStyle(statusIndicatorStyle);
val statusIndicatorStyle = StatusIndicatorStyle()statusIndicatorStyle.cornerRadius = 3.5fstatusIndicatorStyle.borderColor = Color.GREENmessageHeader.setStatusIndicatorStyle(statusIndicatorStyle)
These are a set of small functional customizations that allow you to fine-tune the overall experience of the component. With these, you can change text, set custom icons, and toggle the visibility of UI elements.Here is a code snippet demonstrating how you can customize the functionality of the Message Header component.
For advanced-level customization, you can set custom views to the component. This lets you tailor each aspect of the component to fit your exact needs and application aesthetics. You can create and define your views, layouts, and UI elements and then incorporate those into the component.
The MessageHeader component consists of a ListItemView. You can customize the ListItem according to your requirements by using the .setListItemView method.
header.setListItemView(View);
Example
You have to create a custom_header_item.xml as a custom layout file. This file can then be inflated and passed to setListItemView() method.