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()
查看答案
8Activity中如果加载多个Fragment,切换显示第三个Fragment,请问下面的代码哪些能实现()?
A. replaceFragment(R.id.main_fm,new Fragment1())
B. replaceFragment(R.id.main_fm,new Fragment2())
C. replaceFragment(R.id.main_fm,new Fragment3())
D. replaceFragment(R.id.main_fm,new Fragment4())
9 Fragment类中创建执行的方法是()?
A. onCreate( )
B. OnAttach( )
C. onStart( )
D. onCreateView( )
10 Fragment碎片可见执行的方法是()?
A. onSaveInstance( )
B. onStart( )
C. onResume( )
D. onStop( )
11 Fragment进入后台模式执行的方法是()?
A. onRestart( )
B. onPause()
C. onResume( )
D. onStop( )