180 lines
6.5 KiB
XML
180 lines
6.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<androidx.constraintlayout.widget.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="match_parent"
|
|
android:background="#1e2b28"
|
|
tools:context=".ui.ProfileFragment">
|
|
|
|
<!-- 第一行: 左边文字,右边控件 -->
|
|
<TextView
|
|
android:id="@+id/titleText"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:gravity="center_vertical"
|
|
android:paddingStart="16dp"
|
|
android:paddingTop="16dp"
|
|
android:paddingBottom="16dp"
|
|
android:text="@string/library"
|
|
android:textColor="#ffffff"
|
|
android:textSize="24sp"
|
|
app:layout_constraintEnd_toStartOf="@id/settingsIcon"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<ImageView
|
|
android:id="@+id/settingsIcon"
|
|
android:layout_width="40dp"
|
|
android:layout_height="40dp"
|
|
android:layout_margin="16dp"
|
|
android:src="@drawable/ic_launcher_background"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<!-- 第二行: 左边和右边矩形区域, 中央图标+两行文字 -->
|
|
<LinearLayout
|
|
android:id="@+id/leftSection"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:orientation="vertical"
|
|
android:padding="16dp"
|
|
app:layout_constraintEnd_toStartOf="@id/rightSection"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/titleText">
|
|
|
|
<!-- 矩形背景 -->
|
|
<FrameLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="120dp"
|
|
android:layout_gravity="center"
|
|
android:background="@drawable/round_rectangle"
|
|
android:backgroundTint="@android:color/holo_green_light">
|
|
<!-- 中央图标 -->
|
|
<ImageView
|
|
android:layout_width="48dp"
|
|
android:layout_height="48dp"
|
|
android:layout_gravity="center"
|
|
android:src="@drawable/ic_launcher_foreground" />
|
|
</FrameLayout>
|
|
|
|
<!-- 标题 -->
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="left"
|
|
android:text="Title 1"
|
|
android:textColor="#ffffff"
|
|
android:textSize="16sp" />
|
|
|
|
<!-- 副标题 -->
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="left"
|
|
android:text="Subtitle"
|
|
android:textColor="#ffffff"
|
|
android:textSize="12sp" />
|
|
|
|
</LinearLayout>
|
|
|
|
|
|
<LinearLayout
|
|
android:id="@+id/rightSection"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_weight="1"
|
|
android:orientation="vertical"
|
|
android:padding="16dp"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toEndOf="@id/leftSection"
|
|
app:layout_constraintTop_toBottomOf="@id/titleText">
|
|
|
|
<!-- 矩形背景和中央图标 -->
|
|
<FrameLayout
|
|
android:layout_width="match_parent"
|
|
android:layout_height="120dp"
|
|
android:layout_gravity="center"
|
|
android:background="@drawable/round_rectangle"
|
|
android:backgroundTint="@android:color/holo_red_light">
|
|
|
|
<!-- 中央图标 -->
|
|
<ImageView
|
|
android:layout_width="48dp"
|
|
android:layout_height="48dp"
|
|
android:layout_gravity="center"
|
|
android:src="@drawable/ic_launcher_foreground" />
|
|
</FrameLayout>
|
|
|
|
<!-- 标题 -->
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="left"
|
|
android:text="Title 2"
|
|
android:textColor="#ffffff"
|
|
android:textSize="16sp" />
|
|
|
|
<!-- 副标题 -->
|
|
<TextView
|
|
android:layout_width="wrap_content"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="left"
|
|
android:text="Subtitle"
|
|
android:textColor="#ffffff"
|
|
android:textSize="12sp" />
|
|
|
|
</LinearLayout>
|
|
|
|
|
|
<!-- 第三行: 一行文字 -->
|
|
<TextView
|
|
android:id="@+id/singleTextRow"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:gravity="left"
|
|
android:padding="16dp"
|
|
android:text="This is a single text row"
|
|
android:textColor="#ffffff"
|
|
android:textSize="16sp"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/rightSection" />
|
|
|
|
<!-- 第四行: 左边控件,右边文字 -->
|
|
<ImageView
|
|
android:id="@+id/iconLeft"
|
|
android:layout_width="40dp"
|
|
android:layout_height="40dp"
|
|
android:layout_margin="16dp"
|
|
android:src="@drawable/ic_launcher_background"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/singleTextRow" />
|
|
|
|
<TextView
|
|
android:id="@+id/rightText"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:gravity="center_vertical"
|
|
android:padding="16dp"
|
|
android:text="This is right-aligned text"
|
|
android:textColor="#ffffff"
|
|
android:textSize="16sp"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toEndOf="@id/iconLeft"
|
|
app:layout_constraintTop_toBottomOf="@id/singleTextRow" />
|
|
|
|
<!-- 第五行: RecyclerView -->
|
|
<androidx.recyclerview.widget.RecyclerView
|
|
android:id="@+id/recyclerView"
|
|
android:layout_width="0dp"
|
|
android:layout_height="0dp"
|
|
android:padding="16dp"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@id/iconLeft" />
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|