Call learning Android development input method

A method (if already displayed on the input window is hidden, otherwise shown)

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);

Method II (view accepted view of the soft keyboard input, SHOW_FORCED represents forced display)

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.showSoftInput(view,InputMethodManager.SHOW_FORCED); 
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); //强制隐藏键盘

Automatic pop-up input methods

mCommentEdittext.setFocusable(true);
mCommentEdittext.setFocusableInTouchMode(true);
mCommentEdittext.requestFocus();
InputMethodManager inputManager = (InputMethodManager) mCommentEdittext.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
inputManager.showSoftInput(mCommentEdittext, 0);

Call the hidden system default input method

((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(WidgetSearchActivity.this.getCurrentFocus().getWindowToken()
      , InputMethodManager.HIDE_NOT_ALWAYS);
WidgetSearchActivity is the current Activity

Gets open input method status

IMM = InputMethodManager (InputMethodManager) the getSystemService (Context.INPUT_METHOD_SERVICE);
 Boolean the isOpen imm.isActive = (); // the isOpen if returns true, the input opening

 

 

 

 

 

 

end

Guess you like

Origin www.cnblogs.com/guanxinjing/p/11076295.html