与fragmentmanager.popbackstack()的问题;

时间:2014-12-05 12:13:35

标签: android-fragments back-stack

无法解决Fragments回堆栈的问题。当我尝试弹出时,它会抛出错误:

  

无法找到课程   'android.support.v4.app.FragmentTransitionCompat21 $ 1',引用自   方法android.support.v4.app.FragmentTransitionCompat21.setEpicenter   找不到课   'android.support.v4.app.FragmentTransitionCompat21 $ 3',引用自   方法   android.support.v4.app.FragmentTransitionCompat21.setSharedElementEpicenter

并再次反击,它崩溃了。

我的代码:

FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.fragment_place, fragment, fragmentTag);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();

Pop:

int stackCount = getSupportFragmentManager().getBackStackEntryCount();
if (stackCount > 0) {
    getSupportFragmentManager().popBackStackImmediate();
}

0 个答案:

没有答案