0
0

More than 1 year has passed since last update.

Androidでアプリ起動時にEditTextにフォーカスがあたらないようにする方法

Posted at

概要

Androidでアプリ作成時にアプリ起動時にEditTextにフォーカスがデフォルトであたっていた。
そのため、特定の端末ではアプリ起動時にキーボードが表示されてしまうという現象が発生した。
この現象を修正するために行った、起動時にEditTextにフォーカスがあたらないようにする方法を記載する。
アプリを作成する際に使用していた言語はKotlin

アプリ起動時にEditTextにフォーカスがあたらないようにする方法

AndroidのLayoutのxmlでEditTextの親のレイアウトに以下のコードを追加する。
こうすることでアプリ起動時にEditTextにフォーカスはあたらなくなる。

android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0