監聽軟鍵盤登錄按鈕
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_UNSPECIFIED) {
hiddenInputMethod();
loginAction();
}
return false;
}
/**
* 隱藏軟鍵盤
*/
public void hiddenInputMethod() {
View focusView = this.getCurrentFocus();
if (focusView != null) {
((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(focusView.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}