Я использую com.google.android.material.textfield.TextInputLayout и пытаюсь добиться появления поля ввода, как на первом изображении:
Но это выводит сообщение об ошибке следующим образом:
Как сделать так, чтобы это выглядело на первой картинке?
ОБНОВЛЕНИЕ: Это мой 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>
Попробуй это:
<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>
И здесь у вас есть варианты, которые вы можете иметь для ошибки.
app:errorEnabled setError(CharSequence)
style="@style/FontRoboRegularSizeMFontPrimaryOneLineMatchWrap"
и замените наstyle="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"