Fragment(二)-----分析执行的过程篇
来源:互联网 发布:中国2016年cpi数据 编辑:程序博客网 时间:2024/05/29 09:26
按照官网的例子的修改而成
1、Fragment初始化的流程
主界面调用下面的加载布局的代码后,
setContentView(R.layout.news_articles);//加载布局中的fragment
布局:news_articles.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment android:name="com.example.android.fragments.HeadlinesFragment" android:id="@+id/headlines_fragment" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" /> <fragment android:name="com.example.android.fragments.ArticleFragment" android:id="@+id/article_fragment" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" /></LinearLayout>
界面就开始加载android:name中声明的类,其执行的流程
详情见图。
2、添加一个Fragment
// Create fragment and give it an argument for the selected articleArticleFragment newFragment = new ArticleFragment();Bundle args = new Bundle();args.putInt(ArticleFragment.ARG_POSITION, position);newFragment.setArguments(args);//添加一些附带的参数进去FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this// fragment,// and add the transaction to the back stack so the user can// navigate backtransaction.replace(R.id.fragment_container, newFragment);transaction.addToBackStack(null);// Commit the transactiontransaction.commit();
详见:http://blog.csdn.net/aomandeshangxiao/article/details/7671533#t8
3、自己
- Fragment(二)-----分析执行的过程篇
- Mapreduce(二):MR的执行过程分析
- Netty的启动执行过程分析(二)
- magento-----(一)前后台url的区别分析----(二)模块的执行过程分析
- 云计算(二十二)- 分析MapReduce执行过程
- Oracle体系结构及备份(二)——执行select语句的过程分析
- HiveSQL的执行过程分析
- Task的执行过程分析
- 分析schedule()的执行过程
- 开源中国源码学习UI篇(二)之NavigationDrawer+Fragment的使用分析
- Fragment加载过程分析。
- Fragment加载过程分析
- 深入理解PHP代码的执行的过程(二)
- JIT的执行过程和原理(二)
- Android6.0中ART执行类方法的过程分析二
- mplayer的执行过程分析(本地、网络)
- springmvc的执行过程的源码分析
- Mapreduce执行过程分析(基于Hadoop2.4)——(二)
- ios菜鸟之路:UIView简单的动画
- 批量去掉文件夹中的.svn文件
- mac客户端界面卡顿问题的一个可能原因
- UML-----关系
- day1--2012.10.12
- Fragment(二)-----分析执行的过程篇
- (转)基于用户投票的排名算法(二):Reddit
- geomagic由点云生成三角网
- 国际电话号码的区号mysql数据表
- s3c6410移植3.3.7内核
- PHP之XCache缓存使用
- 搭建Maven私服
- sql 存储过程 开发 常用语法记录 备忘
- jquery命令汇总