Как изменить стиль EditText в AlertDialog?

#android #android-edittext #android-alertdialog #material-components-android #android-textinputlayout

#Android #android-edittext #android-alertdialog #материал-компоненты-android #android-textinputlayout

Вопрос:

Я добавил Cyanea (движок темы) в свое приложение, и стиль EditText изменился (см. Изображения, цвет не имеет значения. Первая картинка — это то, как она выглядит сейчас, а вторая — это то, как я хочу, чтобы диалог выглядел). Как я могу изменить старый стиль EditText обратно?

введите описание изображения здесь

Мой код:

dialog_input.xml

 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    android:paddingBottom="4dp"
    android:paddingTop="16dp">

    <com.google.android.material.textfield.TextInputLayout
        android:id="@ id/md_input_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <EditText
            android:id="@ id/subj_name_input_edit_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:text="Hello, World!"
            android:hint="@string/subject_name_dialog_hint"
            android:inputType="text"
            android:maxLines="1"
            android:maxLength="32" />
    </com.google.android.material.textfield.TextInputLayout>
</FrameLayout>
  

Ответ №1:

Используйте Widget.Design.TextInputLayout стиль:

    <com.google.android.material.textfield.TextInputLayout
        style="@style/Widget.Design.TextInputLayout"
  

введите описание изображения здесь