打开导航抽屉时清除堆栈

时间:2016-04-27 22:20:42

标签: android android-fragments navigation-drawer onbackpressed

打开导航栏时,如何清除除主屏幕后的后栈?

其他信息:我只有2项活动。我主要处理碎片。我在操作栏中有一个导航按钮。当我反击我的活动显示以前不需要的片段。我打开抽屉时要清除所有碎片。

1 个答案:

答案 0 :(得分:1)

你的答案在这里:

Is this the right way to clean-up Fragment back stack when leaving a deeply nested stack?

基本上,你想要的是getSupportFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);

相关问题