Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kubode/b216269e3c1fcf81fb33 to your computer and use it in GitHub Desktop.
Save kubode/b216269e3c1fcf81fb33 to your computer and use it in GitHub Desktop.

親にTabHostがある場合、注意が必要。

TabHostはdispatchWindowFocusChangedをオーバーライドしており、CurrentViewにのみイベントを伝搬させている。

つまり、Tab自体のViewや、FragmentTabHostを使用している場合、子ViewのonWindowFocusChangeは呼ばれない。

これを防ぐには、TabHostを継承してdispatchWindowFocusChangedをオーバーライドし、ViewGroupと同じ実装にすればよい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment