Disable SPACE key in EditText android -
i'd created edittext following.
<edittext android:id="@+id/et_regis_num" android:maxlines="1" android:layout_width="match_parent" android:layout_height="wrap_content" android:digits="1234567890abcdefghijklmnopqrstuvwxyz" android:hint="@string/txt_reg_num" android:inputtype="textcapcharacters" android:maxlength="10" />
in edittext don't want press space key when i'm pressing space key it's working backspace key. means it's deleting 1 character in each twice press.
set inputfilter
on edittext
. please check below answer it's worked me.
inputfilter filter = new inputfilter() { public charsequence filter(charsequence source, int start, int end, spanned dest, int dstart, int dend) { (int = start; < end; i++) { if (character.iswhitespace(source.charat(i))) { return ""; } } return null; } }; edttxt.setfilters(new inputfilter[] { filter });
Comments
Post a Comment