In Android EditText, how to force writing uppercase?

前端 未结 23 1819
后悔当初
后悔当初 2020-11-27 12:28

In my Android application I have different EditText where the user can enter information. But I need to force user to write in uppercase letters. Do you know a

23条回答
  •  佛祖请我去吃肉
    2020-11-27 12:57

    Simply, Add below code to your EditText of your xml file.

    android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    

    And if you want to allow both uppercase text and digits then use below code.

    android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
    

提交回复
热议问题