pans
2017-08-30 71c92f101b6c8b4a678a8c3cfe2d8edbf488efa4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package cn.com.basic.face.util;
 
import android.app.Activity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
 
import cn.com.basic.face.base.MainActivity;
 
public class KeyboardUtil {
 
    public static void hideSoftKeyboard() {
        Activity activity = MainActivity.getInstance();
        InputMethodManager inputMethodManager =
                (InputMethodManager) activity.getSystemService(
                        Activity.INPUT_METHOD_SERVICE);
        View view = activity.getCurrentFocus();
        if (view != null) {
            inputMethodManager.hideSoftInputFromWindow(
                    view.getWindowToken(), 0);
        }
    }
 
}