<pre name="code" class="java">
/**
* 隐藏输入法
* @param view
*/
protected void hideInputSoft(View view) {
if (view == null)
<span style="white-space:pre"> </span>return;
Context context = view.getContext();
view.requestFocus();
// 隐藏正在展示的输入法
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0);
// 去除编辑框的焦点
view.clearFocus();
}