Fragment的生存週期
1. 當Fragment第一次被載入到螢幕上時:
11-15 13:05:26.981 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onAttach:
11-15 13:05:26.981 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onCreate:
11-15 13:05:26.981 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onCreateView:
11-15 13:05:26.982 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onActivityCreated:
11-15 13:05:26.983 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onStart:
11-15 13:05:26.984 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onResume:
2. 另外一個Fragment替換了當前Fragment,此時當前的Fragment進入了停止狀態:
11-15 13:10:54.701 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onPause:
11-15 13:10:54.702 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onStop:
11-15 13:10:54.702 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onDestroyView:
3. 按下Back鍵,Fragment重新回到螢幕:
11-15 13:15:15.086 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onCreateView:
11-15 13:15:15.087 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onActivityCreated:
11-15 13:15:15.087 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onStart:
11-15 13:15:15.087 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onResume:
5. 再次按下Back鍵
11-15 13:16:48.405 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onPause:
11-15 13:16:48.405 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onStop:
11-15 13:16:48.405 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onDestroyView:
11-15 13:16:48.406 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onDestroy:
11-15 13:16:48.406 3013-3013/cn.edu.npu.fragmenttest D/RightFragment: onDetach: