2014-10-03 102 views
1

標題幾乎說明了一切。在平板電腦和橫向模式下,ActionDrawer會保持打開狀態,如下所示。爲什麼我的ActionDrawer顯示在我的內容後面?

這裏是佈局sw720dp土地

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> 
    <android.support.v4.widget.DrawerLayout android:id="@+id/drawer_layout" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="match_parent"> 
     <com.mobile.library.custom.ActionDrawerListView 
      android:id="@+id/left_drawer" 
      android:layout_width="@dimen/navigation_drawer_width" 
      android:layout_height="fill_parent" 
      android:background="@color/tableBackground" 
      android:layout_gravity="start" /> 
    </android.support.v4.widget.DrawerLayout> 
    <FrameLayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" 
    android:layout_marginLeft="@dimen/drawer_content_margin" /> 
</FrameLayout> 

在這裏,XML是正常的佈局:

<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" > 
    <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_marginLeft="@dimen/drawer_content_margin" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
    <com.mobile.library.custom.ActionDrawerListView 
     android:id="@+id/left_drawer" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="wrap_content" 
     android:background="@color/tableBackground" 
     android:layout_gravity="start"/> 
</android.support.v4.widget.DrawerLayout> 

這裏是什麼樣子我盤旋一些圖片從ActionDrawer enter image description here

+0

抽屜佈局應該是最後一次在resorce文件 – 2014-10-03 19:16:57

+1

**「......在橫向模式下ActionDrawer是假設保持開放......」 **:我只想澄清......永久固定的,用戶可以」不管怎麼樣關閉它?如果是這種情況,你正在使用錯誤的方法,應該看看一個主 - 細節景觀佈局(我假設你的'content_frame'與'Fragment'或'Fragments'一起使用)。 – Squonk 2014-10-03 20:16:07

+0

@Squonk有道理,我會考慮下一次衝刺。 – arinte 2014-10-06 13:33:40

回答

0

我有一段時間沒有這樣做,但我相信你必須改變順序:

<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" > 

    <com.mobile.library.custom.ActionDrawerListView 
     android:id="@+id/left_drawer" 
     android:layout_width="@dimen/navigation_drawer_width" 
     android:layout_height="wrap_content" 
     android:background="@color/tableBackground" 
     android:layout_gravity="start"/> 
     <FrameLayout 
     android:id="@+id/content_frame" 
     android:layout_marginLeft="@dimen/drawer_content_margin" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
    </android.support.v4.widget.DrawerLayout> 
+0

爲什麼選擇downvoted?如果這是錯誤的,我想知道:) – ajacian81 2014-10-04 12:51:54

相關問題