How to EditText accepts alphabets only in Android?

Add this line in your EditText tag in layout(xml) file or you can read more about this here

android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Full code EditText should be look like

<EditText 
android:id="@+id/edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
android:layout_width="fill_parent"
android:hint="Enter Full Name"
android:layout_height="wrap_content" />

Leave a Reply

Your email address will not be published. Required fields are marked *