我只是将日志标签放在大多数活动和片段方法上,结果如下:
06-19 16:33:11.934: I/Fragment Activity:MainMenuPager(15820): onCreate - BEGIN
06-19 16:33:11.958: I/Fragment Activity:MainMenuPager(15820): onCreate - END
06-19 16:33:11.958: I/Fragment Activity:MainMenuPager(15820): onStart - BEGIN
06-19 16:33:11.958: I/Fragment Activity:MainMenuPager(15820): onStart - END
06-19 16:33:11.958: I/Fragment Activity:MainMenuPager(15820): onResume - BEGIN
06-19 16:33:11.958: I/Fragment Activity:MainMenuPager(15820): onResume - END
06-19 16:33:11.973: I/HomeFragment(15820): onAttach- BEGIN
06-19 16:33:11.973: I/HomeFragment(15820): onAttach- BEGIN
06-19 16:33:11.973: I/HomeFragment(15820): onCreate- BEGIN
06-19 16:33:11.973: I/HomeFragment(15820): onCreate- END
06-19 16:33:11.973: I/HomeFragment(15820): onCreateView- BEGIN
06-19 16:33:11.981: I/HomeFragment(15820): onCreateView- END
06-19 16:33:11.989: I/HomeFragment(15820): onActivityCreated- BEGIN
06-19 16:33:11.989: I/HomeFragment(15820): onActivityCreated- END
06-19 16:33:11.989: I/HomeFragment(15820): onStart- BEGIN
06-19 16:33:11.989: I/HomeFragment(15820): onStart- END
06-19 16:33:11.989: I/MyProcessListFragment(15820): onAttach- BEGIN
06-19 16:33:11.989: I/MyProcessListFragment(15820): onAttach- BEGIN
06-19 16:33:11.989: I/MyProcessListFragment(15820): onCreate- BEGIN
06-19 16:33:11.989: I/MyProcessListFragment(15820): onCreate- END
06-19 16:33:11.989: I/MyProcessListFragment(15820): onCreateView- BEGIN
06-19 16:33:12.012: I/MyProcessListFragment(15820): onCreateView- END
06-19 16:33:12.012: I/MyProcessListFragment(15820): onActivityCreated- BEGIN
06-19 16:33:12.012: I/MyProcessListFragment(15820): onActivityCreated- END
06-19 16:33:12.012: I/MyProcessListFragment(15820): onStart- BEGIN
06-19 16:33:12.012: I/MyProcessListFragment(15820): onStart- END
那么为什么所有记录的活动方法都首先运行,然后是所有 Fragment 的?片段应该在各种活动状态之间运行吗?