How can restrict my EditText input to some special character like backslash(/),tild(~) etc by soft keyboard in android programmatically

前端 未结 10 1958
故里飘歌
故里飘歌 2020-12-08 04:02

I am developing an application for keyboard, but i am geting an issue. I want to restrict/block some special character from soft keyboard in EditText in android programmatic

10条回答
  •  悲&欢浪女
    2020-12-08 04:25

    Its late but may be helpfull for others. Instead of programaticaly, you can go with xml attribute. It may be the case that in Single layout you have many editText, out of which you wanna restrict special characters only in one EditText. So defining in xml will help you out. Here is the code to restrict special Characters by allowing them to only enter alphabets and numbers like below

    
    

提交回复
热议问题