First letter capitalization for EditText

后端 未结 17 2061
傲寒
傲寒 2020-11-28 01:11

I\'m working on a little personal todo list app and so far everything has been working quite well. There is one little quirk I\'d like to figure out. Whenever I go to add a

17条回答
  •  时光说笑
    2020-11-28 01:47

    Earlier it used to be android:capitalize="words", which is now deprecated. The recommended alternative is to use android:inputType="textCapWords"

    Please note that this will only work if your device keyboard Auto Capitalize Setting enabled.

    To do this programatically, use the following method:

    setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS);

提交回复
热议问题