Viewpager、Tablayout切换页面和Drawerlayout侧滑的连用布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

 <android.support.v4.widget.DrawerLayout
     android:id="@+id/drawer"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
<android.support.v4.view.ViewPager
    android:id="@+id/view_pager"

    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    ></android.support.v4.view.ViewPager>
 <android.support.design.widget.TabLayout
     android:id="@+id/tab_layout"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"></android.support.design.widget.TabLayout>
</LinearLayout>

 <LinearLayout
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:orientation="horizontal"
     android:layout_gravity="left"
     android:background="#0f0"

     >
i<ListView
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:id="@+id/list_view"

     ></ListView>

 </LinearLayout>
 </android.support.v4.widget.DrawerLayout>
</LinearLayout>

猜你喜欢

转载自blog.csdn.net/zhe_guan/article/details/87880277