For android's navigation drawer, why setDisplayHomeAsUpEnabled is required
-
getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayHomeAsUpEnabled(true); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.open_drawer, R.string.close_drawer ); mDrawerLayout.setDrawerListener(mDrawerToggle); This is part of my code I'm using to set the navigation drawer and the app icon to toggle it. I'm very confused in that why is it required to setDrawerListener when already while constructing the DrawerToggle object we have specified the DrawableLayout in the constructor. Second, why is the setDisplayHomeUpEnabled required when we are actually not enabling it. And without it, why isn't the ic_drawer displayed? Thanks.
-
Answer:
From documentation https://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html ActionBarDrawerToggle can be used directly as a DrawerLayout.DrawerListener, or if you are already providing your own listener, call through to each of the listener methods from your own. So setDrawerListener method is for setting drawer listener, it could be custom one or you could use your ActionBarDrawerToggle object because it already implements DrawerLayout.DrawerListener. Setting setDisplayHomeUpEnabled is showing < sign in your action bar but when using navigation drawer it shows three lines. This is how it is implemented.
emotionull at Stack Overflow Visit the source
Related Q & A:
- How to make collapsible navigation drawer only for specific item?Best solution by Stack Overflow
- It's possible to convert an application Android (.apk) in iOS (.ipa?Best solution by Stack Overflow
- What's the minimum salary required to live in Budapest, Hungary?Best solution by Yahoo! Answers
- What's better: Android OS or Blackberry OS?Best solution by techradar.com
- How does Brazil celebrate Christmas, what do they do when it's Christmas, and why do they do it?Best solution by ask.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.