public static void hideSoftKeyboard (Activity activity, View view) { InputMethodManager imm = (InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); }
private void hideKeyboard() { Activity activity = getActivity(); if (activity == null) { return; } InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); View decorView = activity.getWindow().getDecorView(); if (decorView != null) { imm.hideSoftInputFromWindow(decorView.getApplicationWindowToken(), 0); } }
buttonLayout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { editText.requestFocus(); InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.toggleSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.SHOW_FORCED, 0); } });
AutoCompleteTextView auto_text = (AutoCompleteTextView)findViewById(R.id.auto_insert_meds); auto_text.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { InputMethodManager in = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); in.hideSoftInputFromWindow(arg1.getApplicationWindowToken(), 0); } });
public static void hideKeyboard(Context context, View layoutThatContainsEditText) { ((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(layoutThatContainsEditText.getApplicationWindowToken(), 0); }
public void hideKeyboard(Context context, View view) { view.requestFocus(); imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
public static void hideSoftKeyboard (Activity activity, View view) { InputMethodManager imm =(InputMethodManager)activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0);}
public static void hideKeyboard(Context context, View view) { InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); inputMethodManager.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); }
public static void hideSoftKeyboard (Context context, View view) { try { InputMethodManager imm = (InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } catch (Exception ex) { Log.w(TAG, "hideSoftKeyboard->"+ex.toString()); } }
public void hideKeyboard(Context context, View view) { try { view.requestFocus(); imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm!=null) { imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }catch (Exception e){ } }
/** * 隐藏虚拟键盘 */ public static void hide(View v) { InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null && imm.isActive()) { imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } }
public static void hideSoftInput(View view) { if (view == null) return; InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } }
/** * 隐藏输入法 * * @param view */ public static void hideInputmethod(View view) { InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(view.getApplicationWindowToken(), 0); } }
public void dismissFragmentDialog() { if (mCurrentDialog != null) { InputMethodManager manager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); manager.hideSoftInputFromWindow(mCurrentDialog.getWindow().getDecorView() .getApplicationWindowToken(), 0); mCurrentDialog.setOnDismissListener(null); mCurrentDialog.dismiss(); mCurrentDialog = null; } }
@Override public void run() { inputMethodManager.hideSoftInputFromWindow(getBaseActivity().getCurrentFocus().getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); reEdittext.setVisibility(View.GONE); } }, 300);
@Override public boolean onKey(View v, int keyCode, KeyEvent event) { pressSearch = (keyCode == KeyEvent.KEYCODE_ENTER); if (pressSearch && listener != null) { /*隐藏软键盘*/ InputMethodManager imm = (InputMethodManager) v.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isActive()) { imm.hideSoftInputFromWindow(v.getApplicationWindowToken(), 0); } listener.onSearchClick(v); } return false; }
public void hideInputMenu() { inputMethodManager.hideSoftInputFromWindow(getBaseActivity().getCurrentFocus().getApplicationWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
/** * Method used to hide keyboard */ private void hideSoftKeyboard() { if (this.getCurrentFocus() != null) { try { InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(this.getCurrentFocus().getApplicationWindowToken(), 0); } catch (RuntimeException e) { //ignore } } }
@Override public boolean matchesSafely(Root root) { int type = root.getWindowLayoutParams().get().type; if ((type == WindowManager.LayoutParams.TYPE_TOAST)) { IBinder windowToken = root.getDecorView().getWindowToken(); IBinder appToken = root.getDecorView().getApplicationWindowToken(); if (windowToken == appToken) { return true; } } return false; }
@Override public boolean matchesSafely(Root root) { if (root.getWindowLayoutParams().get().type != WindowManager.LayoutParams.TYPE_TOAST) { return false; } return root.getDecorView().getWindowToken() == root.getDecorView().getApplicationWindowToken(); } }