Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NextFocusDown doesn't work with AutoCompleteTextView

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 :)

like image 945
user1984849 Avatar asked Jan 22 '13 10:01

user1984849


People also ask

Which properties can control type of character in AutoCompleteTextView control?

android:completionThreshold This defines the number of characters that the user must type before completion suggestions are displayed in a drop down menu.

How do I set autocomplete text on Android?

If you want to get suggestions , when you type in an editable text field , you can do this via AutoCompleteTextView. It provides suggestions automatically when the user is typing. The list of suggestions is displayed in a drop down menu from which the user can choose an item to replace the content of the edit box with.

How do I create an AutoCompleteTextView field in XML?

In android, we can create an AutoCompleteTextView control in two ways either manually in an XML file or create it in the Activity file programmatically. First we create a new project by following the below steps: Click on File, then New => New Project. After that include the Kotlin support and click on next.


1 Answers

add this to your AutoCompleteTextView

android:imeOptions="actionNext" 

and it should work.

like image 156
techieWings Avatar answered Sep 22 '22 12:09

techieWings