Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Material Design

You're reading from   Learning Material Design Master Material Design and create beautiful, animated interfaces for mobile and web applications

Arrow left icon
Product type Paperback
Published in Dec 2015
Publisher
ISBN-13 9781785289811
Length 186 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Authors (2):
Arrow left icon
Nadir Belhaj Nadir Belhaj
Author Profile Icon Nadir Belhaj
Nadir Belhaj
Kyle Mew Kyle Mew
Author Profile Icon Kyle Mew
Kyle Mew
Arrow right icon
View More author details
Toc

Drawer functionality

Many recent widgets and views are not viewable using Android Studio's preview or design modes, and although there are frequent updates to rectify these issues, there will always be times when the only way to view a layout is to run it on an emulator or device. As it stands, the code we have will not compile until we enter the Java code explained in the following two parts of the exercise. Firstly, we will connect our app bar, drawer, and navigation view, and secondly, we will see how to link navigation items to the rest of our apps. The chapter concludes with a look at alternative ways to implement sliding drawers.

Activating the navigation drawer

Once the following code has been entered, it will be possible to view and test your navigation bar:

  1. Open the MainActivity file and add the following lines in the onCreate() method to replace the action bar with our toolbar:
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
  2. Beneath this, add the...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime