<?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"
    android:id="@+id/search"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingTop="30dp"

    android:background="@drawable/background_cake">

    <!-- 返回按钮：固定宽高，作为对齐基准 -->
    <ImageView
        android:id="@+id/im_back"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:padding="13dp"
        android:layout_marginStart="12dp"
        android:src="@mipmap/back_left"
        android:clickable="true"
        android:focusable="true"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <!-- 标题：与返回按钮垂直居中对齐 + 水平居中（在返回按钮和搜索按钮之间） -->
    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="13dp"
        android:text="@string/app_name"
        android:textColor="@color/title_color"
        android:textSize="20sp"
        android:textStyle="italic|bold"
        app:layout_constraintTop_toTopOf="@id/im_back"
        app:layout_constraintBottom_toBottomOf="@id/im_back"
        app:layout_constraintStart_toEndOf="@id/im_back"
        app:layout_constraintEnd_toStartOf="@id/btn_search"/>

    <!-- 搜索框父布局 -->
    <RelativeLayout
        android:id="@+id/et_parent"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="15dp"
        android:layout_marginTop="15dp"
        android:layout_marginEnd="5dp"
        android:background="@drawable/bg_search_shape_cake"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toStartOf="@id/btn_search"
        app:layout_constraintTop_toBottomOf="@id/im_back">

        <EditText
            android:id="@+id/et_search"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/search_sketches"
            android:paddingHorizontal="16dp"
            android:layout_marginHorizontal="12dp"
            android:layout_marginVertical="8dp"
            android:imeOptions="actionSearch"
            android:singleLine="true"
            android:background="@null"
            android:textColor="@color/black"
            android:textColorHint="@color/normal"/>

    </RelativeLayout>

    <!-- 搜索按钮 -->
    <ImageView
        android:id="@+id/btn_search"
        android:layout_width="55dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="10dp"
        android:paddingStart="15dp"
        android:paddingTop="6dp"
        android:paddingEnd="15dp"
        android:paddingBottom="6dp"
        android:src="@mipmap/search"
        android:clickable="true"
        android:focusable="true"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/et_parent"
        app:layout_constraintBottom_toBottomOf="@id/et_parent"/>

    <!-- 搜索结果列表 -->
    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/result_recycler"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_marginTop="10dp"
        android:paddingHorizontal="8dp"
        app:layout_constraintTop_toBottomOf="@id/et_parent"
        app:layout_constraintBottom_toBottomOf="parent"/>

    <!-- 空数据占位 -->
    <LinearLayout
        android:id="@+id/empty_layout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:orientation="vertical"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/result_recycler"
        app:layout_constraintBottom_toBottomOf="@id/result_recycler">

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:src="@mipmap/nodata"
            app:tint="@color/text_color"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="12dp"
            android:text="@string/no_search_result"
            android:textColor="@color/text_color" />
    </LinearLayout>

    <!-- 加载进度条 -->
    <ProgressBar
        android:id="@+id/search_pb"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:indeterminateTint="@color/normal"
        android:visibility="gone"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toTopOf="@id/result_recycler"
        app:layout_constraintBottom_toBottomOf="@id/result_recycler"/>

</androidx.constraintlayout.widget.ConstraintLayout>