'How to change underline length in TextInputLayout and make it to start with text position?

I use TextInputLayout in my Profile screen

Profile screen

and I want to underline, text, and floating hint were align. But underline wider and I can't find easy way to line them up.

my xml:

    <com.google.android.material.textfield.TextInputLayout
    android:id="@+id/nameField"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_chainStyle="packed">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/transparent"
        android:hint="@string/PROFILE_NAME_HINT"
        android:inputType="text" />

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

Version of material in gradle:

implementation 'com.google.android.material:material:1.5.0'

I tried to change styles, paddings, it doesn't help. I've noticed that old version of material in other expamples show needed result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source