viewpager管理fragment

viewpager管理fragment时的周期现象

加载第一个时也会加载相邻的第二个,显示完第三个时,第一个会被onstop,再显示是会走onCreateview,onActivityCreate 重新创建view

01-24 11:14:17.345 7667-7667/ PlayFragment: onStop

01-24 11:14:19.334 7667-7667/I/PlayFragment: onCreateView

01-24 11:14:19.335 7667-7667I/PlayFragment: onActivity create

加载生命周期的顺序:
01-24 11:19:24.079 7667-7667/ I/PlayFragment: newInstance

01-24 11:19:24.080 7667-7667I/PlayFragment: onAttach

01-24 11:19:24.080 7667-7667 I/PlayFragment: onCreate

01-24 11:19:24.081 7667-7667 I/PlayFragment: onCreateView

01-24 11:19:24.082 7667-7667I/PlayFragment: onActivity create

退出时的生命周期顺序:
01-24 11:16:15.910 7667-7667 I/PlayFragment: onStop

01-24 11:16:15.912 7667-7667 I/PlayFragment: onDestroy

01-24 11:16:15.912 7667-7667 I/PlayFragment: onDetach

你可能感兴趣的:(viewpager管理fragment)