EditText自动弹出软键盘

 1         editText.requestFocus()
 2         editText.isFocusable = true
 3         editText.isFocusableInTouchMode = true
 4         val timer = Timer()
 5         timer.schedule(object : TimerTask() {
 6             override fun run() {
 7                 if (editText != null) {
 8                     val imm = this@MainActivity.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
 9                     imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED)
10                 }
11             }
12         }, 200)
原文地址:https://www.cnblogs.com/yanyojun/p/8729251.html