Customize Chat Message Bubble
Adding a Custom Chat Bubble
implementation 'com.android.support:recyclerview-v7:28.0.0'1. Create an XML layout file for the custom bubble
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="8dp"
android:background="@color/tapWhite">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@mipmap/ic_launcher"
app:layout_constraintTop_toTopOf="parent" />
<!--We are using TapTalk'io's default message body style for this TextView-->
<TextView
android:id="@+id/textView"
style="@style/tapLeftBubbleMessageBodyStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
app:layout_constraintTop_toBottomOf="@id/imageView"
tools:text="Message body" />
</android.support.constraint.ConstraintLayout>
2. Create a custom listener
3. Create a custom bubble ViewHolder
4. Create a custom bubble class
5. Add your custom bubble class
Showing Your Custom Bubble in Chat
Last updated