1.讓Edittext獲取焦點:
edittext.requestFocus();
2.彈出軟鍵盤:
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(edittext, InputMethodManager.RESULT_SHOWN);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,InputMethodManager.HIDE_IMPLICIT_ONLY);
3.隱藏軟鍵盤:
重複上面的代碼,顯示軟鍵盤時,運行則隱藏。