原文地址:http://developer.android.com/guide/topics/ui/controls/text.html#Actions
Specifying Keyboard Actions
You can specify the action by setting theandroid:imeOptions
attribute. For example, here's how you can specify the Send action:
你可以通过设置 android:imeOptions 属性来定制 (EditText) 的行为。例如你可以如下定制 发送 行为:
<EditText
android:id="@+id/search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/search_hint"
android:inputType="text"
android:imeOptions="actionSend" />
If you do not explicitly specify an input action then the system attempts to determine if there are any subsequent
android:focusable
fields. If any focusable fields are found following this one, the system applies the (@code actionNext} action to the current
EditText
so the user can select Next to move to the next field. If there's no subsequent focusable field, the system applies the
"actionDone"
action. You can override this by setting the
android:imeOptions
attribute to any other value such as
"actionSend"
or
"actionSearch"
or suppress the default behavior by using the
"actionNone"
action.
如果你没有显式定义一个输入行为,那么如果有后续的 android:focusable 域,系统会尝试自己确定。如果紧跟这个后面发现了一个可聚焦的域,系统会在当前 Editext 中调用 actionNext 使得用户可以选择 Next 来移动到下一个 field。如果没有后续的可聚焦的域,系统则会调用 "actionDone"。你可以通过设置 imeOptionsl 属性来重写这个,为任何其他的值,例如 "actionSend" 或者 “actionSearch” 或者废除通过 "actionNone"来废除默认的行为