如果两个 Activity 都设置了
OnApplyWindowInsetsListener
,前一个 Activity 会在 onStop 时会再触发一次回调
而所有 Fragment 的生命周期都是在 Activity 相应的生命周期中分发的,除非它为动态添加的
以下为Log打印测试
-
MainActivity
跳转到WebActivity
16:27:30.217 CrashReport D >>> MainActivity onPaused <<<
16:27:30.241 CrashReport D >>> WebActivity onCreated <<<
16:27:30.253 CrashReport D >>> WebActivity onStart <<<
16:27:30.307 CrashReport D >>> WebActivity onResumed <<<
16:27:30.332 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:27:30.332 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:27:30.376 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:27:30.376 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:27:30.800 CrashReport D >>> MainActivity onStop <<<
16:27:30.808 CrashReport D onApplyWindowInsets:MainActivity@9e995d7
16:27:30.809 CrashReport D onApplyWindowInsets:MainActivity@9e995d7
-
WebActivity
锁屏
16:27:57.700 CrashReport D >>> WebActivity onPaused <<<
16:27:57.766 CrashReport D >>> WebActivity onStop <<<
16:27:57.774 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:27:57.774 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
- 解锁进入
WebActivity
16:28:08.405 CrashReport D >>> WebActivity onStart <<<
16:28:08.408 CrashReport D >>> WebActivity onResumed <<<
16:28:08.517 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
16:28:08.518 CrashReport D onApplyWindowInsets:WebActivity@cf0f2d6
网友评论