Customise your conversation

The DeliveredConversationFragmentsupports various ways to customise the elements inside your conversation. You can achieve this using the methods provided by this component.

If you have not yet set up a conversation Activity please refer to the Initial setup section before continuing.

Message list background

To change the message list background color use the DeliveredConversationFragment’s setMessageListBackgroundColor() method, providing a valid color resource id as shown here:

mConversationFragment.setMessageListBackgroundColor(android.R.color.holo_blue_light);

This will produce the following result:

conv_custom_bg.png

Message bubble color scheme

You can also change the background and text color of message bubbles. This applies to both incoming and outgoing messages. To achieve this use the DeliveredConversationFragment’s setIncomingMessageScheme() and setOutgoingMessageScheme() methods providing valid color resource ids as parameters. Each method’s first parameter corresponds to the background color of the bubble, the second one being the text color:

mConversationFragment.setIncomingMessageScheme(
        ContextCompat.getColor(this, android.R.color.black),
        ContextCompat.getColor(this, android.R.color.white));

mConversationFragment.setOutgoingMessageScheme(
        ContextCompat.getColor(this, android.R.color.white),
        ContextCompat.getColor(this, android.R.color.black));

Using the previous code snippet will produce the following result:

conv_custom_bubbles.png

Message text size

To change the message text size simply call the DeliveredConversationFragment’s setMessageTextSize() method providing the value of the desired text dimension (measured in sp units) as shown in the following code snippet:

mConversationFragment.setMessageTextSize(24);

Producing the following result:

conv_text_size.png

Not calling the setMessageTextSize() method will result in the SDK using the default value of 18sp for the message text size.