如何从 TextInputLayout 中删除白框

Gok*_*oku 14 android android-layout material-design android-textinputlayout androidx

今天我刚刚更新了我dependenciesmaterial design

1.0.01.1.0-alpha09

implementation 'com.google.android.material:material:1.1.0-alpha09'
Run Code Online (Sandbox Code Playgroud)

现在我遇到了奇怪的问题 com.google.android.material.textfield.TextInputLayout

这是我的代码

            <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/emailTextInputLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/_10sdp">

            <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/emailTextInputEditText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/hint_enter_email"
                    android:imeOptions="actionNext"
                    android:inputType="textEmailAddress"/>
        </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

更新依赖项后,我在我的 TextInputLayout

上面代码的输出

在此处输入图片说明

如果我使用implementation 'com.google.android.material:material:1.0.0'我会得到预期的结果

在此处输入图片说明

谁能帮我解决这个问题

如果需要更多信息,请告诉我。提前致谢。您的努力将不胜感激。

更新

我已经试过 app:boxBackgroundMode="none"了,我得到了这个

输出 ,

如果我使用app:boxBackgroundMode="outline"然后得到这个

输出

解决了

无需使用 boxBackgroundMode

你需要@style/Widget.Design.TextInputLayout在你的TextInputLayout

示例代码

        <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/emailTextInputLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="@dimen/_10sdp"
                style="@style/Widget.Design.TextInputLayout"
                app:errorTextAppearance="@style/error_appearance"
                android:textColorHint="@android:color/white">

            <com.google.android.material.textfield.TextInputEditText
                    android:layout_width="match_parent"
                    android:id="@+id/emailTextInputEditText"
                    android:layout_height="wrap_content"
                    android:backgroundTint="@android:color/white"
                    android:gravity="center"
                    android:hint="@string/hint_enter_email"
                    android:imeOptions="actionNext"
                    android:textColorHint="@android:color/white"
                    android:inputType="textEmailAddress"
                    android:textColor="@android:color/white"
                    android:textSize="@dimen/_15ssp"/>
        </com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

输出 在此处输入图片说明

Jee*_*ede 13

要恢复为没有归档背景而只有底部边框的旧样式,应使用以下样式:

<com.google.android.material.textfield.TextInputLayout
           ...
           style="@style/Widget.Design.TextInputLayout"
           ....
           >
</com.google.android.material.textfield.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

使用主题Widget.Design.TextInputLayout将生成如下预期的输出:

在此处输入图片说明