簡體   English   中英

如何更改下划線顏色錯誤textinputlayout android

[英]How to change underline color error textinputlayout android

我想知道如何更改 TextInputLayout 下划線的錯誤顏色。

TextInputLayout 有錯誤

只需使用app:boxStrokeErrorColor屬性:

    <com.google.android.material.textfield.TextInputLayout
        app:boxStrokeErrorColor="@color/primaryLightColor"
        ...>

在此處輸入圖像描述

它需要 Material Components 庫版本1.2.0

您可以像這樣更改edittext背景中的顏色。 此背景使下划線消失。 但是你可以把它變成你想要的任何顏色。

<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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM