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)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM