如何在AlertDialog中更改EditText样式?

问题描述

我在我的应用程序中添加了Cyanea(主题引擎),并且EditText样式发生了变化(请参见图像,颜色无关紧要。第一张图片是现在的外观,第二张图片是我希望对话框显示的外观喜欢)。如何更改旧的EditText样式?

enter image description here

我的代码

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>

解决方法

使用Widget.Design.TextInputLayout样式:

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

enter image description here

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...