0
我目前有一個使用TabLayout的ViewPager。我根據ViewPager的頁數動態地向TabLayout添加元素。使用ViewPager將DrawerLayout添加到TabLayout中
我想在TabLayout的左邊添加一個帶有漢堡圖標的DrawerLayout。滾動TabLayout時,該漢堡圖標應保持可見。
我嘗試使用父親RelativeLayout在TabLayout旁邊添加DrawerLayout而沒有任何成功。
這裏是我想怎樣做:
這是當前XML:
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<!-- Side navigation drawer UI -->
<ListView
android:id="@+id/navList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#ffeeeeee"/>
</android.support.v4.widget.DrawerLayout>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/drawer_layout"
app:tabMaxWidth="0dp"
app:tabMode="fixed"
app:tabGravity="fill"/>
</RelativeLayout>
</android.support.design.widget.AppBarLayout>
...
...
...
</android.support.design.widget.CoordinatorLayout>