Up next

Android tutorial (2018) - 57- Add the Navigation Drawer button to the app bar

6 Views· 14 Aug 2019
ITCOURSES
ITCOURSES
5 subscribers
0

It is a good practice to place an icon for the app drawer on your app bar. If you want your Navigation Drawer to appear above the app bar you have to use the ToolBar instead of ActionBar.

By placing a menu icon on the App Bar the user can easily identify that there is a Navigation Drawer Menu available with this application.

Following are the steps to enable Drawer Icon on the App Bar.

1. Replace the Default ActionBar with ToolBar
2. Set the toolbar as the support ActionBar
3. Get an instance of Support ActionBar
4. Call setDisplayHomeAsUpEnabled on the the ActionBar instance and pass true in it.
5 Set your own custom menu icon by calling the setHomeAsUpIndicator method on the ActionBar instance
6. You can open the Navigation Drawer by using the onOptionsItemSelected method

Like my Facebook page : https://www.facebook.com/codeglympse
Subscribe My YouTube channel : http://www.youtube.com/ticoontechnologies

Show more
100% online learning from the world's best universities, organisations and Instructors

 0 Comments sort   Sort By


Up next