Navigation Bar in ActionBar
-
21-12-2019 - |
Question
I have application and I'm using ActionBar. In every activity I'm using navigation button which takes me back to parent activity. Now I would like to add similar button in main activity which activate menu (the same action is implemented in Gmail Android Application).
Main Activity in Gmail application:
Main Activity in Gmail application after using navigation (menu) button in left top corner:
Do you know how can I do it?
Solution
That sliding menu is called Navigation Drawer.
Check this for a guide and sample app: http://developer.android.com/intl/es/training/implementing-navigation/nav-drawer.html
In that link explains how to configure the Action Bar and the menu itself.
UPDATE:
To handle click in that specific button you have to add this in your
public boolean onOptionsItemSelected(MenuItem item)
method:
if(drawerToggle.onOptionsItemSelected(item))
{
// Your code.
return true;
}
You can find more about the object drawerToggle in the link I provided. Good luck.
OTHER TIPS
Please read this training post. Download and investigate sample attached to this post.
I think that the navigation drawer it's the object that you search