public class KeyboardUtils {
/**
* 显示键盘
* @param view
*/
public static voiddisplaySoft(View view) {
InputMethodManager imm = (InputMethodManager)view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
/**
* 隐藏键盘
*/
public static voidhideSoft(View view) {
InputMethodManager imm = (InputMethodManager)view.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
}
}
网友评论