How to block characters in EditText in Android?

How to block characters in EditTexton Android?

+4
source share
2 answers

You can use InputFilterto limit input to EditTexts. Either do your own, or use NumberKeyListenerto enter numerical values.

+5
source

You can do this through an XML file too. As I show here you can try below code: -

     <EditText
                    android:id="@+id/et_date"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:clickable="false"
                    android:cursorVisible="false"
                    android:focusable="false"
                    android:focusableInTouchMode="false"
                    android:hint="dd/mm/yy"
                    android:inputType="text"
                    android:textColor="@color/sky_blue"
                    android:fontFamily="@font/poppinsregular"
                    android:textSize="@dimen/sp_14"/>
0
source

Source: https://habr.com/ru/post/1725264/


All Articles