1.看好是否是 DrawerLayout
侧拉里面控件主要是看这行代码 android:layout_gravity="start" "start"指的是左侧 "end":菜单在右
设置隔空点失效 :android:clickable="true"
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/drawer">
<!--主内容-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我是中国人"
android:background="#00f"
android:layout_alignParentRight="true"
android:id="@+id/tv"/>
<!--用来存放fragment的容器-->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frcontent"
android:layout_below="@+id/tv"
></FrameLayout>
</RelativeLayout>
<!--菜单内容
android:layout_gravity="start":菜单在左侧
android:layout_gravity="end":菜单在右侧
菜单宽度 最好不要超过320dp-->
<LinearLayout
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="start"
android:background="#ccc"
android:id="@+id/menu">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_launcher"
android:id="@+id/img"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lv"
></ListView>
</LinearLayout>
</android.support.v4.widget.DrawerLayout>