1. NavigationView介绍
表示Android应用程序的标准导航菜单。 菜单内容可以由菜单资源文件填充。
2.使用模板
NavigationView通常放在DrawerLayout中。
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<!-- 你的内容 -->
<android.support.design.widget.NavigationView
android:id="@+id/navigation"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:menu="@menu/my_navigation_items" />//导航菜单
</android.support.v4.widget.DrawerLayout>