NavigationView(导航抽屉)做一个简单的侧滑菜单
自己学习的一些小项目,记录在博客里面。有不足之处希望各位大佬指正!!!
运行效果:
1.activity_main.xml布局如下:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="#fffff0"
tools:openDrawer="start">
<TextView
android:textSize="20dp"
android:id="@+id/main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这是一个主界面!!!"/>
<android.support.design.widget.NavigationView
android:layout_gravity="left"
app:headerLayout="@layout/head"
app:menu="@menu/menu"
android:id="@+id/navi"
android:layout_width="wrap_conte