今天学习了fragment的动态添加。
private void replaceFragment(Fragment fragment){ Bundle bundle=new Bundle(); bundle.putString("nowid",Nowid); fragment.setArguments(bundle); FragmentManager fragmentManager=getSupportFragmentManager(); FragmentTransaction transaction=fragmentManager.beginTransaction(); transaction.replace(R.id.userfragment,fragment); transaction.commit(); }