Fragment使用笔记(四)

coding

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

以上是 Fragment使用笔记(四) 的全部内容, 来源链接: utcz.com/z/509449.html

回到顶部