遇到需要侧滑菜单这种情况,以前总是用slidingmenu,今天我们用drawerLayout实现,比前者代码简单多了.
本例效果:
先看布局文件:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<!--这个是toolbar-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="45dp"
android:background="?attr/colorPrimary"
/>
<!--今天的主题,drawerLayout-->
<android.support.v4.widget.