Android EditText with TextInputLayout crashing when reaching limit of counterMaxLength after update of Support Library 23.2.0
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.
Support Library 26.x.x
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.