Home » Android » android – Next Button in Keyboard is not showing

android – Next Button in Keyboard is not showing

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want when user type then instead of arrow key it should show the next button in keyboard.
So user not need to press the back to input next edittext.

Added the Layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:background="#D5D5D5"
    android:orientation="vertical" >

    <FrameLayout
        android:id="@+id/topLinearLayout"
        android:layout_width="fill_parent"
        android:layout_height="45dip"
        android:background="@drawable/bar" >

        <ImageView
            android:id="@+id/new_quote_imageView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/new_quote_bar" />

        <TextView
            android:id="@+id/contactUs"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="@string/contact_us"
            android:textColor="@android:color/white"
            android:textSize="15sp" />
    </FrameLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="match_parent"
        android:gravity="center_vertical"
        android:orientation="vertical" >

        <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:padding="10dip" >

                <LinearLayout
                    android:layout_width="fill_parent"
                    android:layout_height="0dip"
                    android:layout_weight=".7"
                    android:background="#EEEBE6"
                    android:orientation="vertical"
                    android:padding="15dip" >

                    <TextView
                        android:id="@+id/nameTextView"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dip"
                        android:text="@string/name"
                        android:textColor="@android:color/black"
                        android:textSize="16sp" />

                    <EditText
                        android:id="@+id/nameEditText"
                        android:layout_width="fill_parent"
                        android:layout_height="40dip"
                        android:layout_marginTop="10dip" />

                    <TextView
                        android:id="@+id/emailTextView"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dip"
                        android:text="@string/email"
                        android:textColor="@android:color/black"
                        android:textSize="16sp" />

                    <EditText
                        android:id="@+id/emailEditText"
                        android:layout_width="fill_parent"
                        android:layout_height="40dip"
                        android:layout_marginTop="10dip"
                        android:inputType="textEmailAddress" />

                    <TextView
                        android:id="@+id/commentsTextView"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:paddingLeft="5dip"
                        android:text="@string/comments"
                        android:textColor="@android:color/black"
                        android:textSize="16sp" />

                    <EditText
                        android:id="@+id/commentsEditText"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dip"
                        android:lines="5" />

                    <View
                        android:layout_width="fill_parent"
                        android:layout_height="1dp"
                        android:layout_marginTop="5dip"
                        android:background="@android:color/darker_gray" />

                    <LinearLayout
                        android:layout_width="fill_parent"
                        android:layout_height="match_parent"
                        android:layout_marginBottom="10dip"
                        android:layout_marginTop="10dip"
                        android:gravity="right|center_vertical"
                        android:weightSum="1" >

                        <Button
                            android:id="@+id/submitButton"
                            android:layout_width="0dip"
                            android:layout_height="35dip"
                            android:layout_weight=".3"
                            android:background="@drawable/button_background"
                            android:text="@string/submit"
                            android:textColor="@android:color/white"
                            android:textSize="16sp" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>

</LinearLayout>

Please help me for this.

Thanks in advance.

How to&Answers:

add this line to your edittext xml

android:singleLine="true"

Answer:

If you don’t want multiple line simple add

android:singleLine="true"

else please use this given solution

                  <EditText
                    android:id="@+id/commentsEditText"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dip"
                    android:imeOptions="actionNext"
                    android:lines="5" />

I have added

  android:imeOptions="actionNext"

this line extra, use this in every EditText that you want have next button in soft key Board

Answer:

Define inputType for each edit text.

<EditText
     android:id="@+id/editText"
     android:inputType="textPersonName" />

Answer:

Try adding this to the edit text:

android:singleLine="true"

Answer:

android:singleLine=”true” //deprecated

use android:maxLines=”1″ & imeOptions

                android:maxLines="1"
                android:imeOptions="actionNext"

Answer:

Simply use 
android:inputType="textNoSuggestions"
android:maxLines="1"

and remove if you have used digits.

android:digits

Answer:

Add below line in your edittext

android:imeOptions="flagNavigateNext"

Example given below:

<EditText
        android:id="@+id/commentsEditText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dip"
        android:lines="5"             
        android:imeOptions="flagNavigateNext"/>

Answer:

Try adding this

android:imeOptions="flagNavigateNext"
android:inputType="text"