动态加载fragment
private void setTabSelection(int index) { FragmentTransaction transaction = fragmentManager.beginTransaction(); hideFragments(transaction); switch (index) { case 0: if (vipxcFragment == null) { vipxcFragment = new VipxcFragment(); transaction.add(R.id.upgrade_content, vipxcFragment); } else { transaction.show(vipxcFragment); } break; case 1: if (viplyFragment == null) { viplyFragment = new ViplyFragment(); transaction.add(R.id.upgrade_content, viplyFragment); } else { transaction.show(viplyFragment); } break; default: break; } transaction.commit();
我要如何获取fragment内部的控件呢
使用SharedPreferences保存值