Android setUserVisibleHint never gets called?

寵の児 提交于 2019-11-30 08:38:52

setUserVisibleHint is available so that you have a way to tell the system the fragment is in fact not visible and not the other way around, when you are doing some fancy fragment transactions that specifically hide it. You can't use it to determine visibility and it defaults to true.

You should use the isVisible call to know if the fragment is visible and onAttach of the fragment or the root view classes to get callbacks when it's been attached to the activity or the respective root views.

BruceDu
setUserVisibleHint() 

only works in a FragmentPagerAdapter. Please refer to Is Fragment.setUserVisibleHint() called by the android System?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!