为什么我的ActionDrawer显示在我的内容后面?

问题描述:

标题几乎说明了一切。在平板电脑和横向模式下,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

我有一段时间没有这样做,但我相信你必须改变顺序:

<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