导航抽屉与活动和儿童碎片

问题描述:

我有一个活动 A ,一个 ListFragment P 2片段 问:研究

I have a Activity A, a ListFragment P and 2 Fragments Q and R.

当应用程序启动时, A 创建,它会加载 P 。基于什么用户点击,它被替换为问:研究

When the app is launched, A is created, which loads P. Based on what user clicks, it is replaced by Q or R.

现在通过引用教程中,我实现了一个导航抽屉这说明某些项目给用户。但是,由于我在活动中实现的抽屉式导航,它显示了所有的片段。 我想这是只适用于 P

Now by referencing this tutorial, I have implemented a Navigation Drawer which shows certain items to the user. However, since I have implemented the Navigation Drawer in the Activity, it shows for all the Fragments. I want it to be only available to P.

(大类似于谷歌的Gmail应用程序,当用户在主屏幕上 - 抽屉是present当用户点击打开邮件,抽屉改变后退按钮。)

(Very much similar to Googles Gmail app. When the user is on the main screen - the drawer is present. When user taps to open an email, the drawer changes to back button)

我不知道如何翻译上述code。任何帮助是AP preciated。

I am not sure how to translate the above code. Any help is appreciated.

我通过简单地调用重写了克拉行为,解决这一问题的 mDrawerToggle.setDrawerIndicatorEnabled(启用)并通过布尔 启用禁用需要。

I solved this issue by simply overriding the up carat behavior by calling the mDrawerToggle.setDrawerIndicatorEnabled(enable) and passing the boolean enable or disable as needed.

(在这里我不想抽屉戏称为该方法的碎片的错误,并在那里我想抽屉中显示调用该方法的真的。我把里面的呼叫 onResume()各自的片段,​​原因很明显的。)

(The fragments where I didn't want the drawer to show called this method with false and where I wanted the drawer to be shown called this method with true. I put the call inside the onResume() of the respective fragment for obvious reasons.)

这工作完全一样我想要的,我没有改变我的项目的设计:)

This works exactly like I want, and I did not have to change the design of my project :).