Android Fragment 生命周期

时间:2021-12-02 01:19:23

  启动的事件触发顺序

F Fragmeent
A Activity

onAttach(F)

onAttachFragment(A)

onCreate(F)

onCreateView(F)

onActivityCreated(F)

onStart(A)

onStart(F)

onResume(F)

  销毁触发顺序

  销毁时,先Fragment后Activity

  onPause
  onDestroy