09

艾鑫4646發表於2024-06-16

history_drawer_layout.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#80FFFFFF"> <!-- 這裡的 #80FFFFFF 表示半透明的白色,80 是透明度值,範圍是00(完全透明)到FF(完全不透明) -->

    <ListView
        android:layout_height="match_parent"
        android:layout_width="wrap_content"
        android:fadingEdge="none"
        android:divider="#aaaaaa"
        android:dividerHeight="0px">
    </ListView>

</LinearLayout>

list_item_chat.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="8dp">

    <ImageView
        android:id="@+id/chat_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:src="@drawable/ic_launcher_foreground" /> <!-- Replace with actual drawable resource -->

    <TextView
        android:id="@+id/chat_text"
        android:layout_width="wrap_content"
        android:layout_height="80dp"
        android:layout_gravity="center"
        android:padding="10dp"
        android:layout_marginTop="10dp"
        android:layout_marginStart="16dp"
        android:background="@drawable/bubble"
        android:textSize="18sp" />
</LinearLayout>

list_item_role.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="8dp">

    <ImageView
        android:id="@+id/role_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:src="@drawable/ic_launcher_foreground" /> <!-- Replace with actual drawable resource -->

    <TextView
        android:id="@+id/role_text"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:layout_marginStart="16dp"
        android:textSize="18sp" />
</LinearLayout>

相關文章