Fragment使用笔记(四)

六月ゝ 毕业季﹏ 提交于 2021-02-18 15:19:48

Fragment + ViewPager + FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT(appcompat)

Fragment生命周期

MainHomeSubFirstFragment: onAttach MainHomeFragment: onAttachFragment: MainHomeSubFirstFragment MainHomeSubFirstFragment: onCreate MainHomeSubSecondFragment: onAttach MainHomeFragment: onAttachFragment: MainHomeSubSecondFragment MainHomeSubSecondFragment: onCreate MainHomeSubFirstFragment: onCreateView: cacheView is null MainHomeSubFirstFragment: onViewCreated MainHomeSubSecondFragment: onCreateView: cacheView is null MainHomeSubSecondFragment: onViewCreated MainHomeSubFirstFragment: onResume: parent show: true MainHomeSubFirstFragment: onResume: true, false

MainHomeSubThirdFragment: onAttach MainHomeFragment: onAttachFragment: MainHomeSubThirdFragment MainHomeSubThirdFragment: onCreate MainHomeSubThirdFragment: onCreateView: cacheView is null MainHomeSubThirdFragment: onViewCreated MainHomeSubFirstFragment: onPause MainHomeSubThirdFragment: onResume: parent show: true MainHomeSubThirdFragment: onResume: true, false

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