hide keyboard in Android

This question already has an answer here:

  • Close/hide the Android Soft Keyboard 69 answers

  • You can hide the virtual keyboard using the InputMethodManager , calling hideSoftInputFromWindow , passing in the token of the window containing your view.

    View view = this.getCurrentFocus();
    if (view != null) {  
        InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
    }
    

    You will need context to for initiating the InputMethodManager and then you can use this code for the view you want.

    链接地址: http://www.djcxy.com/p/16620.html

    上一篇: createScaledBitmap的过滤参数有什么作用?

    下一篇: 在Android中隐藏键盘