獲取InputMethodManager對(duì)象:
InputMethodManager imm = (InputMethodManager) getSystemService(Service.INPUT_METHOD_SERVICE);
切換打開(kāi)/隱藏狀態(tài)
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
打開(kāi)鍵盤(pán)
imm.showSoftInput(view,InputMethodManager.SHOW_FORCED);
隱藏鍵盤(pán)
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
獲取輸入法狀態(tài)
boolean isOpen=imm.isActive();