Petr Ungar
Petr Ungar

Reputation: 31

android:imeOptions="actionNext" does not go to the next EditText

I have encountered a strange behaviour of android:imeOptions="actionNext". When I press next on the keyboard it actually navigates out of the AutoCompleteEditText but doesn't focus on the next one. I am using the same setting for my other EditTexts and it works fine.

Here is the .xml code:

<AutoCompleteTextView
    android:id="@+id/email"
    android:layout_width="match_parent"
    android:layout_height="@dimen/login_form_height"
    android:hint="@string/prompt_email_username"
    android:imeOptions="actionNext"
    android:inputType="textEmailAddress"
    android:maxLines="1"
    android:padding="@dimen/login_form_padding" />

<EditText
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_height="@dimen/login_form_height"
    android:hint="@string/prompt_password"
    android:imeActionId="6"
    android:imeActionLabel="@string/action_sign_in_short"
    android:imeOptions="actionUnspecified"
    android:inputType="textPassword"
    android:maxLines="1"
    android:padding="@dimen/login_form_padding" />

So when I press next it leaves "@+id/email" but doesn't focus on "@+id/password". Any ideas?

Upvotes: 1

Views: 446

Answers (2)

Javier Callally
Javier Callally

Reputation: 1

My solution was the following. Avoid using android:imeOptions="actionNext" in fields where you use android:inputType="textEmailAddress" and everything will work correctly.

<AutoCompleteTextView
    android:id="@+id/email"
    android:layout_width="match_parent"
    android:layout_height="@dimen/login_form_height"
    android:hint="@string/prompt_email_username"
    android:inputType="textEmailAddress"
    android:maxLines="1"
    android:padding="@dimen/login_form_padding" />

<EditText
    android:id="@+id/password"
    android:layout_width="match_parent"
    android:layout_height="@dimen/login_form_height"
    android:hint="@string/prompt_password"
    android:imeActionId="6"
    android:imeActionLabel="@string/action_sign_in_short"
    android:imeOptions="actionUnspecified"
    android:inputType="textPassword"
    android:maxLines="1"
    android:padding="@dimen/login_form_padding" />

Upvotes: 0

Jitesh Prajapati
Jitesh Prajapati

Reputation: 2533

android:singleLine="true" or android:inputType="text" can solve your problem

<AutoCompleteTextView
    android:id="@+id/email"
    android:layout_width="match_parent"
    android:layout_height="@dimen/login_form_height"
    android:hint="@string/prompt_email_username"
    android:singleLine="true"
    android:inputType="text"
    android:imeOptions="actionNext"
    android:maxLines="1"
    android:padding="@dimen/login_form_padding" />

Upvotes: 1

Related Questions