結對作業6

新晋软工小白發表於2024-06-11

實現對方聊天框

 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     <com.makeramen.roundedimageview.RoundedImageView
10         android:id="@+id/imageProfile"
11         android:layout_width="@dimen/_25sdp"
12         android:layout_height="@dimen/_25sdp"
13         android:background="@drawable/background_image"
14         android:scaleType="centerCrop"
15         app:layout_constraintBottom_toBottomOf="@+id/textMessage"
16         app:layout_constraintStart_toStartOf="parent"
17         app:riv_oval="true" />
18 
19     <TextView
20         android:id="@+id/textMessage"
21         android:layout_width="0dp"
22         android:layout_height="wrap_content"
23         android:layout_marginStart="@dimen/_4sdp"
24         android:layout_marginLeft="@dimen/_4sdp"
25         android:background="@drawable/background_received_message"
26         android:paddingStart="@dimen/_12sdp"
27         android:paddingTop="@dimen/_8sdp"
28         android:paddingEnd="@dimen/_12sdp"
29         android:paddingBottom="@dimen/_8sdp"
30         app:layout_constraintWidth_max="wrap"
31         android:textColor="@color/white"
32         android:textSize="@dimen/_13ssp"
33         app:layout_constraintStart_toEndOf="@id/imageProfile"
34         app:layout_constraintTop_toTopOf="parent"
35         app:layout_constraintWidth_percent="0.75" />
36 
37     <TextView
38         android:id="@+id/textDateTime"
39         android:layout_width="0dp"
40         android:layout_height="wrap_content"
41         android:layout_marginTop="@dimen/_4sdp"
42         android:textColor="@color/secondary_text"
43         android:textSize="@dimen/_8ssp"
44         app:layout_constraintStart_toStartOf="@id/textMessage"
45         app:layout_constraintTop_toBottomOf="@+id/textMessage" />
46 
47 </androidx.constraintlayout.widget.ConstraintLayout>

相關文章