2月16日学习日志

今天学习了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();
    }
原文地址:https://www.cnblogs.com/20193925zxt/p/14880905.html