<span style="font-family: Arial, Helvetica, sans-serif;"> private void loadFragmentView() {</span>
// TODO Auto-generated method stub
fTransaction = manager.beginTransaction();
if (manager.getFragments() == null
|| !manager.getFragments().contains(
fragments.get(current_frgmnt))) {
fTransaction.add(R.id.dwn_frgmnt_layout,
fragments.get(current_frgmnt));
}
if (current_frgmnt != previous_frgmnt) {
fTransaction.hide(fragments.get(previous_frgmnt));
}
fTransaction.show(fragments.get(current_frgmnt));
fTransaction.commit();
previous_frgmnt = current_frgmnt;
}
这里fragments是一个保存所有要切换的fragment的list。总之所有fragment都会在这里,只是用show和hide改变了显示状态