I have an app composed by different Fragments, some are equipped with a navigation drawer.
I would like to add the navigation drawer app icon in the MainActivity ActionBar only if required by the active Fragment but I cannot figure out how to do it in a proper way.
Can someone point me in the right direction, please?
Use
mDrawerToggle.setDrawerIndicatorEnabled(false);
whenever you select a fragment that don't want to display the navigation drawer icon.
Write it in your code..
mDrawerToggle.setDrawerIndicatorEnabled(false);
It will solve your problem... :)
Related
I am new to Android. I want to implement navigation drawer as this :
The Navigation drawer should open below App Bar and should have red left pane for category icon and right page (white) with navigation options.
I am trying to convert default Navigation Drawer activity of Android to this style but don't know where to start with.
If anyone can help me implementing this would be great help.
Thanks in advance.
you need a custom navigation drawer to achive that, you can start by following this link https://github.com/awidiyadew/DrawerMultiLevelListview
I want to show the action bar navigation icon on the Right side of the ActionBar [instead of the default left side].
Also I need to have the same slide in animation of the Navigation Drawer icon as in the Gmail and Google plus application.
Is there any way of achieving that animation on the right side easily.
Any kind of help or suggestion is appreciated.
Thanks in advance!
This is how I've implemented the right navigation drawer. Just need to open and close the drawer based on Gravity. In this example they use Gravity.RIGHT, I use Gravity.END. I'm not sure which one is right or wrong. Hope this helps.
This link for ActionBar animation provides some good information, and should give a good base for doing the navigation drawer icon animation.
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.
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.
I have an Activity that its root element is a DrawerLayout, the DrawerLayout has a ListView child that acts as the left view of the drawer layout.
The question is:
How can I force the left drawer's list view to not close completely ?
I want its closed state to be like the photo below
I am currently using Android's guide to Create a Navigation Drawer.
I am open for any other library - like Sliding Menu - if that accomplishes my goal.
Thanks in Advance.
You can use SlidingPaneLayout, it's similar to NavigationDrawer.
Check this tutorial to find out how to reach it.
Why not just use that far leftmost menu as a fragment within your activity. Upon opening the NAv Drawer, you can still have it show the menus that are 2nd or 3rd level. This is pretty standard for our app, with a menu exposed and further menus available upon opening the drawer
I don't know how to really call this but I want to make menu drawer like in drawerlayout but when drawer is close there will be like drawer indicator a;ways float on the left side of screen like this
open
close
is there any way to do like this?
I found library https://github.com/NikolaDespotoski/DrawerLayoutEdgeToggle works well as i wish for.
For this you should be using the SlidingPaneLayout. Here are some examples:
http://www.javacodegeeks.com/2013/10/android-slidingpanelayout-tutorial.html
http://www.recursiverobot.com/post/59642335041/trying-slidingpanelayout-with-fragments-in-android
Because you are working with Fragments here you could tweak the layout so to keep the indicator in the layout.
Maybe SlidingMenu + ActionbarSherlock is a better choice.
Go for Sliding Menu using Drawer which best suites your functionality.
Also you can check the guide for Navigation Drawer in Android