First letter capitalization for EditText

后端 未结 17 2067
傲寒
傲寒 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:57

    I can assure you both the answers will make first letter capital and will not make edittext single line.

    If you want to do it in XMl below is the code

    android:inputType="textCapWords|textCapSentences"
    

    If want to do it in activity/fragment etc below is the code

    momentTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_WORDS | InputType.TYPE_TEXT_FLAG_MULTI_LINE)
    

    PS: If you are having nay other property also you can easily add it with a pipe "|" symbol, just make sure there is no space in xml between the attribute properties

提交回复
热议问题