2014-10-03 69 views
0

您好我想實現一個滑動抽屜覆蓋在我的Android應用程序。我已經採取參考此鏈接:菜單抽屜實現android

https://github.com/SimonVT/android-menudrawer

,並在我的活動實現菜單的抽屜裏。所以我的活動在一個帶有TitlePageIndicator的viewPager中有兩個片段。當我點擊片段中的一個按鈕時,菜單抽屜會打開。目前抽屜也覆蓋titlePageIndicator。我想知道實現一個菜單抽屜,它打開/疊加在viewPager的標題下。或者是不可能的事情?謝謝您的幫助!

回答

0

您可以使用下面的XML,你應該定義一個佈局下方的標題欄,並設置它:

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res/com.mhp.chek" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 

<!-- main layout --> 
<LinearLayout 
    android:id="@+id/base_layout" 
    android:layout_width="match_parent" 
    android:layout_height="fill_parent" 
    android:layout_gravity="end" 
    android:orientation="vertical" > 

    <!-- for example your **viewpager** can define here --> 

</LinearLayout> 

<!-- drawer layout--> 

<LinearLayout 
    android:id="@+id/drawer" 
    android:layout_width="300dp" 
    android:layout_height="fill_parent" 
    android:layout_gravity="end" 
    android:orientation="vertical" > 

</LinearLayout> 

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

注意,您需要支持庫爲這一個。

+0

需要很多!得到它的工作! – user2893564 2014-10-03 18:23:40