android-隐藏或显示软键盘

来源:互联网 发布:牌匾设计软件 编辑:程序博客网 时间:2024/05/22 03:46
//隐藏软键盘   
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(WidgetSearchActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);   

//显示软键盘,控件ID可以是EditText,TextView   
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(控件ID, 0);