1

I am using com.google.android.material.textfield.TextInputLayout, and trying to achive input field appearance like on the first image:

enter image description here

But it renders error message this way:

enter image description here

How to make it look like on the first picture?

UPDATE: This is my xml:

<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/tilEmail"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        app:layout_constraintStart_toEndOf="@id/ivContactIcon"
        app:layout_constraintEnd_toEndOf="@id/gEnd"
        app:layout_constraintTop_toBottomOf="@id/tilHomePhone"
        app:errorEnabled="true"
        android:hint="@string/profile_edit_hint_email"
        >

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/etEmail"
          style="@style/FontRoboRegularSizeMFontPrimaryOneLineMatchWrap"
            android:inputType="textEmailAddress"
            android:imeOptions="actionDone"
            />
    </com.google.android.material.textfield.TextInputLayout>
Oleh Liskovych
  • 991
  • 3
  • 13
  • 31

1 Answers1

0

Try this one :

<com.google.android.material.textfield.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/hint_text">

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

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

And here you have options that you can have for the error.

app:errorEnabled setError(CharSequence)

coroutineDispatcher
  • 7,718
  • 6
  • 30
  • 58