1

TextInputLayout prefix has a small but noticeable spacing to the subsequent text in the TextInputEditText.

In the following image, The first www is the prefix, the following are the regular text. I want to remove the spacing shown in the circle

enter image description here

My code:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/text_input_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:prefixText="www"
    app:prefixTextColor="@color/black">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/text_input_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Thank you!

Nuno Costa
  • 85
  • 1
  • 11

1 Answers1

1

You can override the material_input_text_to_prefix_suffix_padding dimension in your dimens.xml file

Something like:

<dimen name="material_input_text_to_prefix_suffix_padding">0dp</dimen>

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841