我有一个编辑文本框。当用户默认点击它时,虚拟键盘上显示小写字母。
我希望默认情况下在键盘上显示首字母大写,其余字母小写。
如何实现呢?
android:capitalize
已被弃用。请使用:android:inputType
android:inputType="textCapSentences"
EditText
定义中添加android:capitalize="sentences"
。这将使句子的第一个字符大写。如果您想让每个单词以大写字母开头,请使用words。为了将每个字符都大写,使用以下属性:EditText。
android:capitalize="characters"
我在我的EditText
中使用了以下属性,值为textCapCharacters
,以打开虚拟键盘上的大写锁定功能,并且它起作用了。
android:inputType="textCapCharacters"
edittext
中使用以下内容来将键盘上所有字符大写:android:inputType="textCapCharacters"
android:inputType="textCapSentences"