What event is triggered when a tab fragment is selected

前端 未结 3 611
孤城傲影
孤城傲影 2021-01-01 18:40

I\'m using tab fragments in an activity and the actionbar hosts the tabs. What I want to do is that whenever a fragment appears (or re-appears) in the view (selected by the

3条回答
  •  Happy的楠姐
    2021-01-01 19:34

    I haven't tested this, but I believe you can use the onHiddenChanged method of the Fragment

    From the docs:

    Called when the hidden state (as returned by isHidden() of the fragment has changed.

    http://developer.android.com/reference/android/app/Fragment.html#onHiddenChanged%28boolean%29

提交回复
热议问题