More than one editor in android

I want to create an input PIN input field as shown below. I used four edittext for it, but my problem is that they were not able to move the cursor from one editor to another and vice versa. Please help me with this. enter image description here

+4
source share
2 answers

I think something like this will do what you want:

<LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > </EditText> <EditText android:id="@+id/editText2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > </EditText> <EditText android:id="@+id/editText3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > </EditText> <EditText android:id="@+id/editText4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" > </EditText> 

Or do you want to automatically switch from one EditText to another when filling out?

0
source

what do you mean that you cannot "move the cursor from one edittext to another and vice versa"?

As with entering one character / number in the editing text, so that the cursor should move to the next editor?

If so, try getFocus () with a TextWatcher implementation for EditText, it has a callback that is called after every letter you enter.

0
source

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


All Articles