actionNone : 回車鍵,按下后光標(biāo)到下一行
actionGo : Go逗鸣,
actionSearch : 放大鏡
actionSend : Send
actionNext : Next
actionDone : Done枝嘶,確定/完成帘饶,隱藏軟鍵盤,即使不是最后一個文本輸入框
在xml中設(shè)置屬性(此處設(shè)置為軟鍵盤顯示的內(nèi)容):
android:imeOptions="actionDone"
android:singleLine="true"
設(shè)置監(jiān)聽:
EditText.setOnEditorActionListener設(shè)置監(jiān)聽
publicbooleanonEditorAction(TextView v,int actionId, KeyEvent event) {
booleanisOK =true;
switch(actionId) {
case EditorInfo.IME_ACTION_NONE:
break;
case EditorInfo.IME_ACTION_GO:
break;
case EditorInfo.IME_ACTION_SEARCH:
break;
case EditorInfo.IME_ACTION_SEND:
break;
case EditorInfo.IME_ACTION_NEXT:
break;
case EditorInfo.IME_ACTION_DONE:
break;
default:
isOK=false;
break;
}