1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

EditTextにフォーカスをあてたときにだけ表示するようにするTips

Posted at

概要

EditTextにフォーカスをあてたときに独自のkeypadを表示するようなときに使えそうなTips

  • 画面表示時にはkeypadを表示しない
  • EditTextをタップしたときに表示する
  • ホームキータスクキーを押したあとにアプリに戻ってきたときに表示しない

詳細

画面表示時にはkeypadを表示しない

setFoucusableにfalseを指定

EditTextをタップしたときに表示する

setFoucusListnuerとsetOnClickListnerに表示する処理を追加
setFoucusListnuerにも処理を追加しないと何故か1回目にEditTextをたっぷしたときに表示されない
表示する処理を追加するときに
setFoucusable true
setFoucusableTouchMode true
を追加してあげる

ホームキータスクキーを押したあとにアプリに戻ってきたときに表示しない

よくある間違い
フォーカスが当たらなければいいから他のViewにrequest forcusする

多分大丈夫
onPauseでsetFoucusableにfalseを指定
※違うとかもっといい方法があるとかあれば教えてください

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?