fragment生命周期

fragment的生命周期通过以下顺序:onAttach(),onCreate(),onCreateView(),onActivityCreated(),onStart(),onResume(),onPause(),onStop(),onDestoryView(),onDestory(),onDetach()。

fragment的生命周期是依附activity的生命周期的,只有在activity在resumed状态下,fragment的生命周期才能独立运行

onAttach():绑定activity,能获取activity传递过来的值

onCreateView():为fragment创建视图或是加载布局,更新布局

onActivityCreated():activity中的onCreate()方法被调用的时候调用

onDestoryView():移除fragment的布局

onDetach():与activity解绑

创建fragment的时候经历onAttach(),onCreate(),onCreateView(),onActivityCreated()

fragment对用户可见时经历onStart(),onResume()

fragment对用户不可见时经历onPause(),onStop()

fragment销毁时经历onPause(),onStop(),onDestoryView(),onDestory(),onDetach()

 

去除listview边框

android:divider="#ffffff"

posted on 2015-05-04 09:53  2B欢乐多  阅读(223)  评论(0)    收藏  举报