onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
- onCreatView是碎片的生命周期中的一种状态,在为碎片创建视图(加载布局)时调用
- 使用:View view=(.right_fragment,container,false);
- 三个参数的含义及作用
- LayoutInflater inflater:作用类似于findViewById(),findViewById()用来寻找xml布局下的具体的控件(Button、TextView等),LayoutInflater inflater()用来找res/layout/下的xml布局文件
- ViewGroup container:表示容器,View放在里面(还不理解)
- Bundle savedInstanceState:保存当前的状态,在活动的生命周期中,只要离开了可见阶段,活动很可能就会被进程终止,这种机制能保存当时的状态