概要
AndroidのEditTextで入力を確定したあともフォーカスがそのまま残ることがあった。
入力確定後はEditTextからフォーカスは外れてほしい。
そのためAndroidでEditTextからフォーカスを外す方法を記載する。
言語はKotlin
フォーカスを外す
以下のコードを入力確定時のイベントで実行するようにすることでフォーカスが外れるようにすることができる。
val parent = parent as View
parent.isFocusable = true
parent.isFocusableInTouchMode = true
parent.requestFocus()