0

我在android中有注册屏幕。当用户开始键入然后在下一个 EditText 中输入值时,需要按返回然后键入,依此类推。

请帮助我这样的用户不需要多次按下后退按钮来输入。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white" >

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp" 
    android:layout_gravity="center_horizontal"
    android:gravity="center">

    <EditText
        android:id="@+id/senderphoneNumber"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="30dp" 
        android:gravity="center"
        android:hint="SENDER PHONE NUMBER" 
        android:ellipsize="start"
        android:inputType="number"/>

    <EditText
        android:id="@+id/phoneNumber"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="RECIEVER PHONE NUMBER" 
        android:ellipsize="start"
        android:inputType="number"
        android:layout_below="@id/senderphoneNumber"/>

    <EditText
        android:id="@+id/messageText"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="TEXT MESSAGE" 
        android:layout_below="@id/phoneNumber"
        android:imeOptions="actionNext"/>

    <EditText 
        android:id="@+id/mmsCentralURL"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="MMS CENTRAL URL" 
        android:layout_below="@id/messageText"
        android:imeOptions="actionNext"/>

    <EditText 
        android:id="@+id/proxyURL"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="MMS PROXY" 
        android:layout_below="@id/mmsCentralURL" 
        android:imeOptions="actionNext"/>

     <EditText 
        android:id="@+id/port"
        android:layout_width="fill_parent"
        android:layout_height="50dip"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="MMS PORT" 
        android:layout_below="@id/proxyURL" 
        android:imeOptions="actionDone"/>


    <Button
        android:id="@+id/chooseImage"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_marginTop="30dp"
        android:background="@drawable/rounded_button"
        android:text="PICK IMAGE" 
        android:layout_below="@id/port"/>

    <Button
        android:id="@+id/sendButton"
        android:layout_width="fill_parent"
        android:layout_height="40dp"
        android:layout_marginTop="30dp"
        android:background="@drawable/rounded_button"
        android:text="SEND" 
        android:layout_below="@id/chooseImage"/>

    <TextView android:id="@+id/emptyTV"
        android:layout_width="fill_parent"
        android:layout_height="30dp"
        android:layout_below="@id/sendButton"/>

4

1 回答 1

0

Use android:imeOptions="actionDone" on last edittext

For Next - android:imeOptions="actionNext"

For Done - android:imeOptions="actionDone"

-Or-

You can also go with android:nextFocusDown="@+id/next_edit_text"

Check this link: http://developer.android.com/guide/topics/ui/controls/text.html

于 2013-08-22T16:48:27.710 回答