显示键盘 private void showInputMethod(Context context) { //自动弹出键盘 InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); //强制隐藏Android输入法窗口 // inputManager.hideSoftInputFromWindow(edit.getWindowToken(),0); } 隐藏键盘 public static void hideKeyboard(View v){ InputMethodManager inputMethodManager = ( InputMethodManager) v.getContext( ).getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager.isActive()) { inputMethodManager.hideSoftInputFromWindow( v.getApplicationWindowToken() , 0 ); } }
android调用键盘
最新推荐文章于 2021-05-25 23:24:20 发布