In our app we use EditText
with TextInputLayout
to show validation errors. Everything worked fine until we updated to latest support library
use the stable material library
implementation 'com.google.android.material:material:1.0.0'
Just Remove the style what you applied to the TextInputLayout. This is due to Light and Dark theme differences..It's Worked for me.
Version 23.2.0 of design library introduced Theme.Design.*
family of themes which mirror a subset of AppCompat themes but define this attribute on top of it:
<item name="textColorError">@color/design_textinput_error_color_light</item>
Either have your theme extend Theme.Design.*
or copy the above line to your theme.
The textColorError
attribute has to be defined in your theme in order to use error states in TextInputLayout
. Otherwise it will crash just as you mentioned.
You can use your own error color value of course.
The default values are @color/design_textinput_error_color_light
for light themes and @color/design_textinput_error_color_dark
for dark themes.
If you're using support library version 26+ it looks like this
<item name="textColorError">?attr/colorError</item>
for both light and dark themes.
Its a bug which has been already logged here. Its not solved till 23.2.1 design support library. https://code.google.com/p/android/issues/detail?id=202051
Meanwhile you can use the solution mentioned by @Eugen.