如何更改下划线颜色错误 textinputlayout android
How to change underline color error textinputlayout android
我想知道如何更改TextInputLayout下划线的错误颜色。
您可以这样更改编辑文本背景中的颜色。此背景使下划线消失。但是你可以把它变成你想要的任何颜色。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
app:hintEnabled="false">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Floating Hint Disabled"
android:background="@android:color/transparent" />
</android.support.design.widget.TextInputLayout
只需使用 app:boxStrokeErrorColor
属性:
<com.google.android.material.textfield.TextInputLayout
app:boxStrokeErrorColor="@color/primaryLightColor"
...>
它需要 Material 组件库版本 1.2.0
。
我想知道如何更改TextInputLayout下划线的错误颜色。
您可以这样更改编辑文本背景中的颜色。此背景使下划线消失。但是你可以把它变成你想要的任何颜色。
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_horizontal_margin"
app:hintEnabled="false">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Floating Hint Disabled"
android:background="@android:color/transparent" />
</android.support.design.widget.TextInputLayout
只需使用 app:boxStrokeErrorColor
属性:
<com.google.android.material.textfield.TextInputLayout
app:boxStrokeErrorColor="@color/primaryLightColor"
...>
它需要 Material 组件库版本 1.2.0
。