Android EditText with TextInputLayout crashing when reaching limit of counterMaxLength after update of Support Library 23.2.0

前端 未结 4 1192
死守一世寂寞
死守一世寂寞 2020-12-08 15:19

In our app we use EditText with TextInputLayout to show validation errors. Everything worked fine until we updated to latest support library

4条回答
  •  囚心锁ツ
    2020-12-08 16:19

    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:

    @color/design_textinput_error_color_light
    

    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

    ?attr/colorError
    

    for both light and dark themes.

提交回复
热议问题