How to set max length to android keyboard -


i have editbox , max length set 6 digit. works clearly, on keyboard can continue typing.

edittext : 111111

keyboard : 11111111111111111 ....

and when try delete, deletes number right left, when keyboard comes 6. digit, can delete edittext.

do have experience on ?

i cant upload image work,

------------------ -111111          -  - edittext max length 6  ------------------     ------------------- - 1111111111...   - -> recommendation textbox on native keyboard ------------------- 1 2 3 4 5 6 7 8 9 0 q w e .... .. .. .. .. -------------------        <edittext             android:id="@+id/edittextsmspassword"             android:layout_width="match_parent"             android:layout_marginleft="8dp"             android:layout_marginright="8dp"             android:layout_margintop="20dp"             android:ems="10"             style="@style/editboxstandart"             android:maxlength="6"             android:hint="cep Şifre" />        <style name="editboxstandart">         <item name="android:layout_height">@dimen/editbox_standart_height</item>         <item name="android:textsize">@dimen/editbox_standart_text_size</item>         <item name="android:background">@drawable/selector_rounded_text</item>         <item name="android:maxlines">1</item>         <item name="android:singleline">true</item>         <item name="android:typeface">normal</item>     </style> 

android:maxlength="6" should work, since isn't might happening because of new style, use input filter limit max length of text view.

textview editentryvew = new textview(...); inputfilter[] filterarray = new inputfilter[1]; filterarray[0] = new inputfilter.lengthfilter(6); editentryview.setfilters(filterarray); 

Comments