Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only Text in EditText on Android?

Tags:

android

I want to only text (input) in edittext in App Android.! example: Only type "Text: A-> Z", Not allow number or special character.?

Please give me idea, how should it be done? Thank very much.!

like image 515
Võ Hoài Lên Avatar asked Mar 08 '26 23:03

Võ Hoài Lên


2 Answers

Try this way,

android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:inputType="text"

For more info, you may check http://developer.android.com/reference/android/widget/TextView.html#attr_android:digits

like image 124
IntelliJ Amiya Avatar answered Mar 10 '26 13:03

IntelliJ Amiya


I think you can do this by the following attribute in ur xml file.

android:inputType

for more on this see this link:

http://developer.android.com/reference/android/widget/TextView.html#attr_android:inputType

i think you should set it like this:

android:inputType="text"

or try this:

http://www.anddev.org/view-layout-resource-problems-f27/how-to-create-edittext-allow-only-alphabets-capital-and-smal-t12236.html

like image 30
kzs Avatar answered Mar 10 '26 13:03

kzs



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!