這是非常可能的。你只需要爲它創建正確的佈局文件。
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<RelativeLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- viewpager goes here -->
</RelativeLayout>
<!-- The navigation drawer -->
<LinearLayout android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="start">
<!-- fragment one goes here in drawer -->
<!--- fragment two goes here in drawer-->
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
一個DrawerLayout必須有2名兒童,第一個是主要內容,在你的情況下,這將包含ViewPager,也許還有其他的東西。第二個孩子是抽屜本身。
將此作爲活動的內容使用。 的其餘信息可以通過使用Android開發者頁面here
嗨dumazy 你沒明白我的意思我的示例應用程序Navigation Drawer with Tab Strip Example的截圖,可能是我的問題有點混亂。我想讓NavigationDrawer具有LisView Only,並且在它的一個項目上應該顯示ViewPager(帶有三個片段)。 我試圖做到這一點,但現在我堅持在另一個問題,並在過去兩天一直在撓頭我的頭.....它顯示所有ViewPager的片段第一次良好,但沒有顯示第二次片段時,當我返回。 我正在添加一個壓縮的Dropbox鏈接[在這裏](https://www.dropbox.com/s/qa528o2a8lxdkcz/NavDrawer.zip)。請看看它。 – user1288005