Android开发中,如何自己控制键盘的显示和隐藏呢,可以用以下方式实现:
//隐藏
public void hintInputMethodManager(){
InputMethodManager imm = (InputMethodManager) getSystemService(ActivityLiveInteractive.this.INPUT_METHOD_SERVICE);
//隐藏键盘
imm.hideSoftInputFromWindow(mEditMessage.getWindowToken(), 0);
}
//显示
public void showInputMethodManager(){
InputMethodManager inputManager =
(InputMethodManager)mEditMessage.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(mEditMessage, 0);
}
(mEditMessage为传入的EditText)