InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
View view = this.getCurrentFocus();
if (view != null){
imm.showSoftInput(view, 0); //显示软键盘
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);//隐藏软键盘
}