2
votes

Does anyone successfully implemented Navigation Drawer with Fragments, Up Navigation and ActionBar?

As stated in documentation Up Navigation works automatically with Activities. But If I want to implement Navigation Drawer, then I have to use fragments.

I have set:

   ActionBar actionBar = getActionBar();
   actionBar.setDisplayHomeAsUpEnabled(true);
   actionBar.setHomeButtonEnabled(true);

I also put all fragments to BackStack. When checking listener OnBackStackChangeListener, I see that BackStack is being checked, but the Up navigation arrow doesn't show up.

1
A navigation drawer generally directs the flow of the app by opening new screens from a main screen. You want the navigation drawer for every screen?RoraΖ
Yes, whole application should have access to navigation drawer. If not, I guess I could you other activities that overlaps MainActivity, add there ActionBar with Up button,that when clicked closes this Activity, right?Tom

1 Answers

0
votes

Navigation Drawer with Fragments

take a look at this question and this may also help you. As stated in the second link, you don't "have to use Fragments to use the NavigationDrawer"

Although many navigation drawer examples show how fragments can be used with the navigation drawer, you can also use a RelativeLayout/LinearLayout if you wish to use the drawer as an overlay to your currently displayed Activity.

This is actually the approach I've used in one of my recent projects and it works fine.