【问题标题】:How to change EditText style in AlertDialog?如何更改 AlertDialog 中的 EditText 样式?
【发布时间】:2021-01-19 10:57:39
【问题描述】:

我在我的应用程序中添加了 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>

【问题讨论】:

    标签: android android-edittext android-alertdialog material-components-android android-textinputlayout


    【解决方案1】:

    使用Widget.Design.TextInputLayout 样式:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-12-22
      • 2016-01-27
      • 2016-04-04
      • 2013-04-18
      • 2013-04-26
      • 1970-01-01
      • 2012-09-10
      相关资源
      最近更新 更多