如何在 material 文本输入布局的开头放置可绘制的开始图标

How to position drawable start icon at the start of the material text input layout

如何将可绘制的开始图标定位在文本输入布局的开头

<com.google.android.material.textfield.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="New Password"
                    app:expandedHintEnabled="true"
                    app:hintTextAppearance="@style/text_medium_12_size"
                    app:errorTextAppearance="@style/text_regular_10_size"
                    app:boxStrokeColor="@color/main_theme_color"
                    app:startIconDrawable="@drawable/ic_baseline_lock"
                    style="@style/Widget.Design.TextInputLayout">

                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingStart="0dp"
                        android:paddingEnd="0dp"
                        android:drawablePadding="0dp"
                        style="@style/text_medium_12_size"
                        android:importantForAutofill="no"/>

                </com.google.android.material.textfield.TextInputLayout>

上面代码的结果如下图所示

但我想实现文本输入布局开始时的可绘制开始图标,如下图所示

我需要删除文本输入布局的可绘制开始图标之间的额外开始 space。有可能实现吗?

删除 TextInputLayout

中的 app:startIconDrawable="@drawable/ic_baseline_lock"

并在TextInputEditText

中添加android:drawableStart="@mipmap/ic_baseline_lock"
<com.google.android.material.textfield.TextInputLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="New Password"
                    app:expandedHintEnabled="true"
                    app:hintTextAppearance="@style/text_medium_12_size"
                    app:errorTextAppearance="@style/text_regular_10_size"
                    app:boxStrokeColor="@color/main_theme_color"
                    app:startIconDrawable="@drawable/ic_baseline_lock" // remove this line
                    style="@style/Widget.Design.TextInputLayout">

                    <com.google.android.material.textfield.TextInputEditText
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:paddingStart="0dp"
                        android:paddingEnd="0dp"
                        android:drawableStart="@mipmap/ic_baseline_lock" //add this line
                        android:drawablePadding="0dp"
                        style="@style/text_medium_12_size"
                        android:importantForAutofill="no"/>

                </com.google.android.material.textfield.TextInputLayout>