When I press the 'Next', the focus on the User EditText must be move to the Password. Then, from Password, it must move to the right and so on. Can you help me on how to code it?
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User Name*" />
<EditText
android:id="@+id/txt_User"
android:layout_width="290dp"
android:layout_height="33dp"
android:singleLine="true" />
</LinearLayout>
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="@+id/password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password*" />
<EditText
android:id="@+id/txt_Password"
android:layout_width="290dp"
android:layout_height="33dp"
android:singleLine="true"
android:password="true" />
<TextView
android:id="@+id/confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password*" />
<EditText
android:id="@+id/txt_Confirm"
android:layout_width="290dp"
android:layout_height="33dp"
android:singleLine="true"
android:password="true" />
</LinearLayout>
These three lines do the magic
In some cases you may need to move the focus to the next field manually :
You might need this if, for example, you have a text field that opens a date picker on click, and you want the focus to automatically move to the next input field once a date is selected by the user and the picker closes. There's no way to handle this in XML, it has to be done programmatically.
add your editText
add property to activity in manifest
in layout file ScrollView set as root or parent layout all ui
if you do not want every time it adds, create style: add style in values/style.xml
default/style:
Add inputType to edittext and on enter it will go the next edittext
and many more.
If you want to use a multiline
EditText
withimeOptions
, try: