In Android EditText, how to force writing uppercase?

前端 未结 23 1759
后悔当初
后悔当初 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:41

    In kotlin, in .kt file make changes:

    edit_text.filters = edit_text.filters + InputFilter.AllCaps()
    

    Use synthetic property for direct access of widget with id. And in XML, for your edit text add a couple of more flag as:

    
    

    This will update the keyboard as upper case enabled.

提交回复
热议问题