0

may be it is easy question but i am new to android

i have Edit text with android:digits is set but it is ignored and the text accepts all chars

  <EditText
                android:id="@+id/name_et"
                android:layout_width="match_parent"
                android:layout_height="@dimen/_40sdp"
                android:layout_marginHorizontal="@dimen/_20sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:alpha=".7"
                android:background="@drawable/bg_btn_border_gray_transprent"
                android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
                android:maxLines="1"
                android:paddingHorizontal="@dimen/_20sdp"
                android:singleLine="true"
                app:layout_constraintTop_toBottomOf="@id/name_tv"
                android:inputType="text" />

the edittext should accept only chars but now it accept all (numbers,chars, symbols)

why ?

Thanks for helping

Edit this Post is not duplicate it take the contents of the text then validate my requirement that the text does not accept symbols at all it should be done by android:digits but for some reason it does not work

Maher Khalil
  • 529
  • 1
  • 15
  • 28
  • No still accepts numbers and symbols – Maher Khalil Oct 27 '22 at 11:26
  • Does this answer your question? [How to create EditText accepts Alphabets only in android?](https://stackoverflow.com/questions/2361497/how-to-create-edittext-accepts-alphabets-only-in-android) – deHaar Oct 27 '22 at 11:39
  • the accepted answer work but the editText accept any symbols and number then it validate the contents i mean it does not prevent but android:degits prevent entering symbols (or it should prevent) that's what i need – Maher Khalil Oct 27 '22 at 12:00

0 Answers0