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

时间:2014-10-03 19:15:13

标签: android

标题几乎说明了一切。在平板电脑和横向模式下,ActionDrawer会保持打开状态,如下所示。

这是layout-sw720dp-land

的xml
<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>

这是正常的布局:

<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

1 个答案:

答案 0 :(得分: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>