Adding a navigation drawer with fragments
The navigation drawer is a panel that transitions in from the left edge of the screen and displays the app's main navigation options.
How to do it...
We can add a navigation drawer to our app by setting the DrawerLayout
type as the root layout container, with the contents of the drawer and the main content as subviews:
- The
DrawerLayout
type should be the root of our layout file, with two subviews: the first is the main content and the second is the drawer. Let's take a look at the following code snippet:<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawerLayout" android:layout_width="match_parent" ...
Get Xamarin Mobile Development for Android Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.