新支持字符计数的 TextInputLayout

TextInputLayout with new support for character counting

我阅读了 android 开发人员 here 的新博客 post。

TextInputLayout expands its existing functionality of floating hint text and error indicators with new support for character counting.

但我找不到任何对字符计数 的编程代码支持。 我想要一些代码来实现 字符计数 使用 TextInputLayout

有一个新的setCounterEnabled(boolean)方法可以用来启用字符计数器。

它只是显示视图中的当前字符数。