什么是DrawerLayout
DrawerLayout 是一种抽屉式导航栏,简单的说就是一种侧滑控件,比如网易云音乐的侧滑就是DrawerLayout 做的。它不仅节省了屏幕控件,也实现了非常好的动画效果。
简单使用
布局:
<?xml version="1.0" encoding="utf-8"?>
<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"
tools:openDrawer="start"
>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/tool_bar_layout"/>
</FrameLayout>
<TextVi