InputMethodManager imm = (InputMethodManager) context.getApplicationContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); //隐藏
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);//如果输入法显示就隐藏,隐藏就显示