Making an EditText field accept only letters and white spaces in Android

前端 未结 10 707
别跟我提以往
别跟我提以往 2020-12-18 21:09

I have an EditText field in my project which stands for the full name of the person.So I want only letters and spaces to be allowed in it.So I tried the following in the

10条回答
  •  温柔的废话
    2020-12-18 21:35

    Below change worked for me:-

    android:digits="abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    

    Put space in between your strings. If you put space at the end of a string it will get trimmed off automatically.

    I have used space after ending of small letters and starting with capital letters.

提交回复
热议问题