在 android 中向 TextInputLayout 添加两个结束图标

adding two end icons to TextInputLayout in android

i'm trying to achieve something like this

我想创建带有两个结束图标的 TextinputLayout,但它不起作用,清晰的结束图标显示在搜索图标上方,这是我的代码:

   <FrameLayout
    app:layout_constraintTop_toTopOf="parent"
    android:id="@+id/searchLayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <com.google.android.material.textfield.TextInputLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/margin_32dp"
        android:gravity="center"
        android:hint="@string/search_for_your_product"
        app:boxBackgroundMode="none"
        app:endIconMode="clear_text"
        app:layout_constraintStart_toEndOf="@id/backIcon"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/search"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/sh_border_rounded"
            android:inputType="text"
            android:maxLength="10"
            android:maxLines="1"
            android:singleLine="true" />
    </com.google.android.material.textfield.TextInputLayout>
    <ImageView
        android:layout_gravity="end|center_horizontal"
        android:src="@drawable/ll_search"
        android:layout_width="wrap_content"
        android:paddingStart="@dimen/normal_margin"
        android:paddingTop="@dimen/normal_margin"
        android:paddingEnd="@dimen/normal_margin"
        android:layout_height="match_parent"/>
</FrameLayout>

我使用约束布局作为背景的父级, 并在 TextInput 的末尾设置图标。

    <androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/searchLayout"
    android:layout_width="match_parent"
    android:layout_marginStart="@dimen/margin_32dp"
    android:background="@drawable/sh_border_rounded"
    android:layout_height="wrap_content"
    app:layout_constraintStart_toEndOf="@id/backIcon"
    app:layout_constraintTop_toTopOf="parent">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/search"
        android:padding="@dimen/margin_8"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginEnd="@dimen/margin_64dp"
        android:inputType="text"
        android:maxLength="10"
        android:background="@null"
        android:maxLines="1"
        android:singleLine="true"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <ImageView
        android:id="@+id/delete"
        android:src="@drawable/ic_cancel"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_width="wrap_content"
        android:paddingEnd="@dimen/margin_8"
        android:layout_height="match_parent"
        app:layout_constraintStart_toEndOf="@+id/search" />
    <ImageView
        android:src="@drawable/ic_search"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toEndOf="@+id/delete" />
</androidx.constraintlayout.widget.ConstraintLayout>