在使用过程中 FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(R.id.fragment_container, fragment, tag); transaction.addToBackStack(tag); transaction.commit(); getSupportFragmentManager要用在FragmentActivity及其子类中
fragment 所依赖的类必须是FragmentActivity及其子类