I’m trying to focus on the next edit text after the user fills one in. The code works absolutely fine with EditText
but when I apply it on AutoCompleteTextView
, the Next button in the keyboard doesn’t work. The cursor stays where it is.
This is the code I’m using:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="11" >
<AutoCompleteTextView
android:id="@+id/etLN"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:ems="10"
android:nextFocusDown="@+id/etC"
android:inputType="textPersonName" >
<requestFocus />
</AutoCompleteTextView>
<EditText
android:id="@id/etC"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:ems="10"
android:hint="0.0"
android:nextFocusDown="@+id/etD"
android:inputType="numberDecimal"
android:text="" />
<EditText
android:id="@id/etD"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:ems="10"
android:nextFocusDown="@+id/etLN2"
android:hint="0.0"
android:inputType="numberDecimal"
android:text="" />
</LinearLayout>
Please tell me what’s the correct way to do this.
Thanks 🙂
add this to your AutoCompleteTextView
android:imeOptions="actionNext"
and it should work.
Tags: androidandroid, text, view