1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
public class {
public static void show(View view) { if (view == null || view.getContext() == null) return; InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm == null) return; view.requestFocus(); imm.showSoftInput(view, 0); }
public static void hide(View view) { if (view == null || view.getContext() == null) return; InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm == null) return; imm.hideSoftInputFromWindow(view.getWindowToken(),0); }
public static void toggle(View view) { if (view == null || view.getContext() == null) return; InputMethodManager imm = (InputMethodManager) view.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm == null) return; imm.toggleSoftInput(0, 0); } }
|
近期评论