Android,隐藏/显示软键盘

来源:互联网 发布:马甲网络 编辑:程序博客网 时间:2024/04/29 20:37

---------隐藏软键盘

InputMethodManager imm = (InputMethodManager)getSystemService(getApplication().INPUT_METHOD_SERVICE);

imm.hideSoftInputFromWindow(DialogShow.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

---------显示软键盘,控件ID可以是EditText,TextView  

InputMethodManager imm = (InputMethodManager)getSystemService(getApplication().INPUT_METHOD_SERVICE);

imm.showSoftInput(控件ID, 0);

0 0
原创粉丝点击