I used a Material TextInputLayout to show errors when user inputs wrong values. Although, the error logic is working fine, the error displays in a pop-up like this instead of being shown like this under the layout. Can anyone kindly explain what I am doing wrong. This is how I am creating EditText in the layout xml file:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/password_layout_signup_page"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="32dp"
android:layout_marginEnd="32dp"
app:errorEnabled="true"
app:passwordToggleEnabled="true"
android:layout_below="@id/email_layout_signup_page">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/password_edit_signup_page"
style="@style/Body2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/lock_icon"
android:drawablePadding="8dp"
android:drawableTint="@color/hint_gray"
android:ems="10"
android:hint="@string/password_asteriks"
android:inputType="textPassword" />
</com.google.android.material.textfield.TextInputLayout>
And this is how I am setting errors in the corresponding .kt file:
passwordEditText.setError("Be at least 8 characters",null)