Android keyboard hide and show

来源:互联网 发布:elmo控制器 编程 编辑:程序博客网 时间:2024/06/07 01:35

Show

EditText editText = (EditText)findViewById(R.id.myEdit);InputMethodManager mgr = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);// only will trigger it if no physical keyboard is openmgr.showSoftInput(editText,InputMethodManager.SHOW_IMPLICIT);

And to hide:

InputMethodManager mgr =(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);mgr.hideSoftInputFromWindow(editText.getWindowToken(), 0);


0 0
原创粉丝点击