fragment|fragment 生命周期的不同表现
Viewpager +fragment
08-11 11:33:36.1567162-7162/com.example.yinsgo.myui V/Fragment1﹕ setUserVisibleHint false
08-11 11:33:36.1567162-7162/com.example.yinsgo.myui V/Fragment2﹕ setUserVisibleHint false
08-11 11:33:36.1577162-7162/com.example.yinsgo.myui V/Fragment1﹕ setUserVisibleHint true
08-11 11:33:36.1587162-7162/com.example.yinsgo.myui V/Fragment1﹕ onAttach
08-11 11:33:36.1587162-7162/com.example.yinsgo.myui V/Fragment1﹕ onCreate
08-11 11:33:36.1597162-7162/com.example.yinsgo.myui V/Fragment1﹕ onCreateView
08-11 11:33:36.1607162-7162/com.example.yinsgo.myui V/Fragment1﹕ onActivityCreated
08-11 11:33:36.1607162-7162/com.example.yinsgo.myui V/Fragment1﹕ onResume()
08-11 11:33:36.1607162-7162/com.example.yinsgo.myui V/Fragment2﹕ onAttach
08-11 11:33:36.1607162-7162/com.example.yinsgo.myui V/Fragment2﹕ onCreate
08-11 11:33:36.1607162-7162/com.example.yinsgo.myui V/Fragment2﹕ onCreateView
08-11 11:33:36.1617162-7162/com.example.yinsgo.myui V/Fragment2﹕ onActivityCreated
08-11 11:33:36.1617162-7162/com.example.yinsgo.myui V/Fragment2﹕ onResume()当切换到第二个fragment时打印日志:08-11 11:33:54.0847162-7162/com.example.yinsgo.myui V/Fragment3﹕ setUserVisibleHint false
08-11 11:33:54.0847162-7162/com.example.yinsgo.myui V/Fragment1﹕ setUserVisibleHint false
08-11 11:33:54.0847162-7162/com.example.yinsgo.myui V/Fragment2﹕ setUserVisibleHint true
08-11 11:33:54.0847162-7162/com.example.yinsgo.myui V/Fragment3﹕ onAttach
08-11 11:33:54.0857162-7162/com.example.yinsgo.myui V/Fragment3﹕ onCreate
08-11 11:33:54.0857162-7162/com.example.yinsgo.myui V/Fragment3﹕ onCreateView
08-11 11:33:54.0857162-7162/com.example.yinsgo.myui V/Fragment3﹕ onActivityCreated
08-11 11:33:54.0857162-7162/com.example.yinsgo.myui V/Fragment3﹕ onResume()
- 首次setUserVisibleHint true时,fragment还未初始化
- activity进入时,两个fragment都会resume
推荐阅读
- 活着就是生命的全部意义
- 生命过客——第10章|生命过客——第10章 初为人母
- 生命的活力!2019-05-04好事
- 生命中最迷人的部分轻拿轻放
- 日更82/365珍视生命中的每一刻
- 克里希那穆提《生命书》新译(8月15日)(心与念的二元分裂)
- 投资最重要的事之七——关注周期
- 积极探索|积极探索 绽放生命 ???——心心相印计划:青少年心理工作研讨小组全国大型公益行动第二次活动包头市青山区分校圆满成功
- 感恩生命中的所有遇见
- 努力让自己变得更具生命力