Fragment生命周期
Posted qukaige
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Fragment生命周期相关的知识,希望对你有一定的参考价值。
启动Fragment
05-21 14:47:21.514 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onAttach 05-21 14:47:21.514 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onCreate: 05-21 14:47:21.514 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onCreateView: 05-21 14:47:21.522 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onActivityCreated: 05-21 14:47:21.522 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onStart: 05-21 14:47:21.522 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onResume
厉害当前Fragment
05-21 14:54:14.786 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onPause: 05-21 14:54:14.786 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onStop: 05-21 14:54:14.786 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onDestroyView:
重新回到屏幕
05-21 14:56:00.446 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onCreateView: 05-21 14:56:00.446 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onActivityCreated: 05-21 14:56:00.446 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onStart: 05-21 14:56:00.446 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onResume
退出
05-21 15:02:27.418 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onPause: 05-21 15:02:27.418 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onStop: 05-21 15:02:27.418 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onDestroyView: 05-21 15:02:27.418 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onDestroy: 05-21 15:02:27.418 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onDetach
不退出 按下home键
05-21 15:02:14.742 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onPause: 05-21 15:02:15.730 25477-25477/com.example.kaige.fragmenttest1 I/RightFragment: onStop:
以上是关于Fragment生命周期的主要内容,如果未能解决你的问题,请参考以下文章
在不存在的片段上调用片段生命周期和 onCreate 的问题