<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
android:id="@+id/draw"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<com.example.day10_rikao.XListView
android:id="@+id/xlv"
android:layout_width="match_parent"
android:layout_height="match_parent"></com.example.day10_rikao.XListView>
<LinearLayout
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="left"
android:choiceMode="singleChoice"
android:orientation="vertical"
>
<ImageView
android:id="@+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher_round"
/>
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="111111"
/>
<Button
android:id="@+id/btu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="戳一下"
/>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
通过点击时间打开或关闭DrawLayout
drawLayout.openDrawer(GravityCompat.START);
drawer.closeDrawer(GravityCompat.START);