How to close Android Soft KeyBoard programmatically?

前端 未结 14 1306
别跟我提以往
别跟我提以往 2020-12-02 16:33

I am currently showing softkeyboard using the following code

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
im         


        
14条回答
  •  無奈伤痛
    2020-12-02 17:16

    This works fine

    InputMethodManager keyboard = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    keyboard.hideSoftInputFromWindow(getWindow().getAttributes().token, 0);
    

提交回复
热议问题