本文介绍了如何从TextInputLayout删除白框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

今天我刚刚更新了material design

1.0.01.1.0-alpha09

implementation 'com.google.android.material:material:1.1.0-alpha09'

现在我在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>

更新依赖关系后,我在TextInputLayout

after updating the dependencies I'm getting boxed design in my TextInputLayout

以上代码的输出

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

if i use implementation 'com.google.android.material:material:1.0.0' I'm getting expected result

有人可以帮我解决这个问题吗?

Can anybody help me to solve this issue

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

If need more information please do let me know. Thanks in advance. Your efforts will be appreciated.

更新

无需使用 boxBackgroundMode

No need to use boxBackgroundMode

您需要在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>

输出

推荐答案

要恢复为无背景且只有底边框的旧样式,应使用以下样式:

To revert back to old style with no filed background but only bottom border, one should use following style:

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

使用主题 Widget.Design.TextInputLayout 将产生预期的输出,如下所示:

Using theme Widget.Design.TextInputLayout will generate expected output like below:

这篇关于如何从TextInputLayout删除白框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 10:58