我使用导航组件为我的项目。 但是,我很难控制碎片的生命周期。
我有两个片段A和; B,以及到B的导航。
这是我的日志:
SplashFragment: onCreate()
SplashFragment: onCreateView()
SplashFragment: onViewCreated()
HomeFragment: onCreate()
HomeFragment: onCreateView()
HomeFragment: onViewCreated()
SplashFragment: onDestroyView()
SplashFragment: onDestroy()
为什么? 以及如何使它被测序?
谢了。
你无法控制生命周期。 您必须记住生命周期事件在什么情况下发生。