下面列出比较经常用到的几个属性以及替换的文本外观:
actionUnspecified---未指定---EditorInfo.IME_ACTION_UNSPECIFIED.
actionNone---动作---EditorInfo.IME_ACTION_NONE
actionGo---去往---EditorInfo.IME_ACTION_GO
actionSearch---搜索---EditorInfo.IME_ACTION_SEARCH
actionSend---发送---EditorInfo.IME_ACTION_SEND
actionNext ---下一项---EditorInfo.IME_ACTION_NEXT
actionDone---完成---EditorInfo.IME_ACTION_DONE
在布局文件中设置
android:imeOptions="actionNext"
android:inputType="text"
android:maxLines="1"
三个属性一起添加才有效果
在代码中 mUserEdit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
回车键的监听:
private void initListener() {
mUserEdit
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {if (actionId == EditorInfo.IME_ACTION_SEND
|| (event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
//让mPasswordEdit获取输入焦点
mPasswordEdit.requestFocus();
return true;
}
return false;
}
});
}