使用 TextInputLayout 和 TextInputEditText 时删除多余的 space/padding/margin

Remove extra space/padding/margin while using TextInputLayout and TextInputEditText

我想删除下图中多余的space。

https://imgur.com/T5IzbKe

这是我的 xml:

 <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/sh_layout_mobile"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="20dp"
        android:layout_marginTop="28dp"
        android:layout_marginEnd="20dp"
        android:background="@drawable/gradient_back"
        app:boxBackgroundMode="outline"
        app:hintEnabled="false"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/imageView9">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/editText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/transparent"
            android:drawableEnd="@drawable/ic_phone"
            android:drawableTint="@color/white"
            android:drawableTintMode="multiply"
            android:drawingCacheQuality="high"
            android:fontFamily="@font/roboto"
            android:hint="@string/mobile_number"
            android:inputType="textPersonName"
            android:paddingRight="0dp"
            android:textColor="@color/white"
            android:textColorHighlight="@color/white"
            android:textColorHint="@color/white"
            android:textColorLink="@color/white"
            android:textSize="15dp" />

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

我只想最小化或完全删除顶部 space 或边距或填充。我自己尝试并调整了几个设置,但没有任何效果。

为删除填充的 editText 创建样式

 <style name="styleTextInputEditText" parent="Base.Widget.MaterialComponents.TextInputEditText">
    <item name="android:paddingStart">0dp</item>
    <item name="android:paddingEnd">0dp</item>
    <item name="android:paddingTop">0dp</item>
    <item name="android:paddingBottom">0dp</item>
    .....
</style>

并将其分配给您的 textInputLayout editText

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/yourId"
    style="@style/styleTextInput"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    ....>

    <com.google.android.material.textfield.TextInputEditText
        style="@style/styleTextInputEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        .... />
</com.google.android.material.textfield.TextInputLayout>