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);
? ? }
}