3 主视图布局中需要添加一个Fragment;请补全下面的代码;
A. ContentFragment
B. TitleFragment
C. MainAcitivty
D. Activity
查看答案
4 主视图布局中需要添加一个Fragment;请补全下面的代码;
A. ContentFragment
B. TitleFragment
C. MainAcitivty
D. Activity
5 TitleFragment中访问ContentFragment的方法,请补全下列代码?ContentFragment mContentFragment=(ContentFragment)getActivity(). ( ? ).findFragmentById(R.id.fragment_content); mContentFragment.setData(strTitle,strContent);
A. getSupportManager()
B. getManager()
C. getFrament()
D. getSupportFragmentManager()
6 Activity中如果加载多个Fragment,初始化显示第一个Fragment,请补全下面的代码?private void initFragment() { getSupportFragmentManager().( ?).replace(R.id.main_fm,new Fragment1()).commit(); }
A. Transaction()
B. begin()
C. beginTransaction()
D. getFrament()
7 Fragment可以实现动态加载,下面是实现动态加载的过程,请补全代码?private void replaceFragment(int layout,Fragment fragment){ FragmentManager manager=getSupportFragmentManager(); FragmentTransaction fragmentTransaction=manager.beginTransaction(); fragmentTransaction.replace(layout,fragment); fragmentTransaction.addToBackStack(null); ( ? ); }
A. fragmentTransaction.getFragmentById()
B. fragmentTransaction.getAcitivity()
C. fragmentTransaction.commitFragment()
D. fragmentTransaction.commit()