显示输入法:
public void ShowSoftInput(View v) { // v 接受输入的控件 mInputMethodManager = (InputMethodManager) (this .getSystemService(Context.INPUT_METHOD_SERVICE)); mInputMethodManager.showSoftInput(v, 0); }
隐藏输入法:
public void hideSoftInput(View v) { // v 接受输入的控件 mInputMethodManager = (InputMethodManager) (this .getSystemService(Context.INPUT_METHOD_SERVICE));
mInputMethodManager.hideSoftInputFromWindow(v
.getApplicationWindowToken(), 0);
}