美文网首页
OnApplyWindowInsetsListener 的回调问

OnApplyWindowInsetsListener 的回调问

作者: 小强开学前 | 来源:发表于2022-12-21 08:32 被阅读0次

    如果两个 Activity 都设置了OnApplyWindowInsetsListener,前一个 Activity 会在 onStop 时会再触发一次回调
    而所有 Fragment 的生命周期都是在 Activity 相应的生命周期中分发的,除非它为动态添加的

    以下为Log打印测试

    1. 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
    
    1. 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
    
    1. 解锁进入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
    
    

    相关文章

      网友评论

          本文标题:OnApplyWindowInsetsListener 的回调问

          本文链接:https://www.haomeiwen.com/subject/bxxmqdtx.html