03-06 19:57:46.138 8691-8691/com.retech.myapplication E/glz: onAttach
03-06 19:57:46.138 8691-8691/com.retech.myapplication E/glz: onCreate
03-06 19:57:46.143 8691-8691/com.retech.myapplication E/glz: onCreateView
03-06 19:57:46.148 8691-8691/com.retech.myapplication E/glz: onViewCreated
03-06 19:57:46.149 8691-8691/com.retech.myapplication E/glz: onStart
03-06 19:57:46.149 8691-8691/com.retech.myapplication E/glz: onResume
03-06 19:57:56.336 8691-8691/com.retech.myapplication E/glz: onPause
03-06 19:57:56.336 8691-8691/com.retech.myapplication E/glz: onStop
03-06 19:57:56.336 8691-8691/com.retech.myapplication E/glz: onDestroyView
03-06 19:58:01.000 8691-8691/com.retech.myapplication E/glz: onCreateView
03-06 19:58:01.004 8691-8691/com.retech.myapplication E/glz: onViewCreated
03-06 19:58:01.005 8691-8691/com.retech.myapplication E/glz: onStart
03-06 19:58:01.005 8691-8691/com.retech.myapplication E/glz: onResume
这个是在ViewPager中切换Fragment的log
由于Viewpager会加载前一个和后一个,所以在切换到前一个和后一个的时候,都保持在onResume状态
当超出一个,比如从3 切换到了1 那么就会走 onPause -> onStop -> onDestroyView
然后在点击切换到3, 是要重走onCreateView -> onViewCreated ->onStart ->onResume