Fragment与Activity交互
来源:互联网 发布:three.js视频教程下载 编辑:程序博客网 时间:2024/04/29 06:19
Activity直接影响它所包含的Fragment的生命周期,所以对Activity的某个生命周期方法的调用也会产生对Fragment相同方法的调用。例如:当activity的onPause()方法被调用时,它所包含的所有的fragment们的onPause()方法都会被调用。
Fragment比Activity还要多出几个生命周期回调方法,这些额外的方法是为了与activity的交互而设立的。
onAttach():当fragment和activity被关联时调用。
onCreateView():当创建fragment的UI被初始化时调用。
onActivityCreated():当activity的onCreate()方法返回时调用。
onDestroyView():当fragment的UI被移除的时候调用。
onDetach():当fragment和activity去关联时调用。
Android官网解释如下:
onAttach():Called when the fragment has beenassociated with the activity (the Activity is passed in here).
onCreateView():Called to create the view hierarchyassociated with the fragment.
onActivityCreated():Called when the activity'sonCreate() method has returned.
onDestroyView():Called when the view hierarchyassociated with the fragment is being removed.
onDetach():Called when the fragment is beingdisassociated from the activity.
- Fragment与Activity交互
- Fragment 与 Activity交互
- Activity与Fragment交互
- Fragment与Activity交互
- Activity与fragment之间交互
- Fragment与Activity的交互
- Activity与Fragment生命周期交互
- Fragment与Activity的交互
- Android fragment与Activity交互
- fragment与activity交互时生命周期顺序
- fragment 与 Activity 交互小问题
- Fragment 与 Activity 间的交互
- activity与fragment之间的数据交互
- fragment与activity实现数据交互
- 【Android每日点滴】Fragment与Activity交互
- Android中Fragment与Activity交互
- Android Fragment与activity交互方式
- Android Activity与Fragment 数据交互
- 高性能并行编程【openMP】
- awk按照多个分隔符进行分割
- 新的开始
- Android通过Runtime.getRuntime().exec实现Ping和Traceroute命令时readLine阻塞问题解决
- SGU359
- Fragment与Activity交互
- emacs eshell cannot erase-buffer shows text is read only
- HTTP劫持与DNS穿透
- SGU363
- Java中字符串操作方法总结
- SGU358
- 自己动手写字符编码转换函数
- SGU362
- huwei题目5.。。。2014.5.5