Hide soft keyboard after dialog dismiss

前端 未结 8 1786
孤街浪徒
孤街浪徒 2021-01-31 02:16

I want to hide soft keyboard after AlertDialog dismiss, but it\'s still visible. Here is my code:

alert = new AlertDialo         


        
8条回答
  •  野性不改
    2021-01-31 02:45

    in case anyone looks for this in kotlin, it would be:

    private fun hideDeviceKeyboard() {
        val imm = context!!.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
        imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
    }
    

提交回复
热议问题