/**
* Dialog中隐藏软键盘不管用
* @param activity
*/
public static void HideSoftKeyBoard(Activity activity){
try{
InputMethodManager imm =((InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE));
if(imm.isActive()){
imm.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
}
}
catch(Exception ex){
LogUtil.WriteError(ex,tag+"->HideSoftKeyBoard()");
}
}
/**
* Dialog中隐藏软键盘
* @param activity
*/
public static void HideSoftKeyBoardDialog(Activity activity){
try{
InputMethodManager imm = (InputMethodManager) activity.getSystemService(activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_NOT_ALWAYS, 0);
}
catch(Exception ex){
LogUtil.WriteError(ex,tag+"->HideSoftKeyBoard()");
}
}