Live character count for EditText

后端 未结 14 2129
清歌不尽
清歌不尽 2020-11-29 17:07

I was wondering what the best way to do a live character count of an edit-text box is in Android. I was looking at this but I couldn\'t seem to make any sense of it.

<
14条回答
  •  独厮守ぢ
    2020-11-29 18:00

    You can add a counter to your TextInputEditText being wrapped in a TextInputLayout. As you can see in the example, counterEnabled enables this feature and counterMaxLengh defines the number of characters for it.

    
        
    
    

提交回复
热议问题