實現自己的聊天框
1 <?xml version="1.0" encoding="utf-8"?> 2 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="wrap_content" 5 xmlns:app="http://schemas.android.com/apk/res-auto" 6 android:layout_marginTop="@dimen/_8sdp" 7 android:padding="@dimen/_4sdp"> 8 9 <TextView 10 android:id="@+id/textMessage" 11 android:layout_width="0dp" 12 android:layout_height="wrap_content" 13 android:background="@drawable/background_sent_meaasge" 14 android:paddingStart="@dimen/_12sdp" 15 android:paddingTop="@dimen/_8sdp" 16 android:paddingEnd="@dimen/_12sdp" 17 android:paddingBottom="@dimen/_8sdp" 18 android:textColor="@color/white" 19 app:layout_constraintWidth_max="wrap" 20 android:textSize="@dimen/_13ssp" 21 app:layout_constraintEnd_toEndOf="parent" 22 app:layout_constraintTop_toTopOf="parent" 23 app:layout_constraintWidth_percent="0.8"/> 24 25 <TextView 26 android:id="@+id/textDateTime" 27 android:layout_width="0dp" 28 android:layout_height="wrap_content" 29 android:layout_marginTop="@dimen/_4sdp" 30 android:textColor="@color/secondary_text" 31 android:textSize="@dimen/_8ssp" 32 app:layout_constraintEnd_toEndOf="parent" 33 app:layout_constraintTop_toBottomOf="@id/textMessage" /> 34 35 </androidx.constraintlayout.widget.ConstraintLayout>