Android,隐藏/显示软键盘

来源:互联网 发布:雅克比矩阵的意义 编辑:程序博客网 时间:2024/05/17 01:46

 

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

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