android 关闭软键盘

时间:2022-12-14 23:40:29
/**
     * 关闭软键盘
     */
    public static void hideInputMethod(Context context, View view) {
        InputMethodManager imm = (InputMethodManager)
                context.getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
        }
    }