简体   繁体   中英

How to change outline color on TextInputLayout from material component?

I got an error that says:

Error inflating class com.google.android.material.textfield.TextInputLayout

when implementing TextInputLayout from the material component. Actually, I have resolved the problem by put material theme on my root layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".LoginActivity"
**android:theme="@style/Theme.MaterialComponents.Light.NoActionBar"**
android:padding="20dp">

But the outline color and the font changed, what should I do to make the outline color back to my colorAccent ?

Add this line: app:boxStrokeColor="?attr/colorAccent"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM