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

前端 未结 4 1193
死守一世寂寞
死守一世寂寞 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 15:59

    use the stable material library
    implementation 'com.google.android.material:material:1.0.0'

    0 讨论(0)
  • 2020-12-08 16:17

    Just Remove the style what you applied to the TextInputLayout. This is due to Light and Dark theme differences..It's Worked for me.

    0 讨论(0)
  • 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:

    <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.

    0 讨论(0)
  • 2020-12-08 16:23

    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.

    0 讨论(0)
提交回复
热议问题