有两个抽屉的 DrawerLayout:当左边一个打开时,右边一个 "jumping"?

DrawerLayout with two drawers: Right one "jumping" when left one is opened?

我的应用程序有一个 DrawerLayout,里面有两个抽屉,一个在左边用于导航,一个在右边用于通知。当应用程序冷启动时,我滑动打开左边的抽屉,右边的抽屉从屏幕最左边跳到右边。

看起来像这样:http://i.imgur.com/mhoJ7MZ.gifv

如视频所示,我尝试使用 DrawerLayoutisDrawerOpenisDrawerVisible 方法来尝试查看它是否真的认为正确的抽屉在打开时打开不是(因为它似乎是 "closing" 左边的抽屉打开时),但我没有从中得到任何有用的东西。

是什么导致了奇怪的跳跃?

下面是我的activity的XML,完整代码是here.

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">
        ...
    </LinearLayout>

    <LinearLayout
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="#ACFF0000"
        android:gravity="center"
        android:visibility="gone">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="LEFT DRAWER"
            android:textSize="24sp" />

    </LinearLayout>

    <LinearLayout
        android:id="@+id/right_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="end"
        android:background="#AC00FF00"
        android:gravity="center"
        android:visibility="gone">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="RIGHT DRAWER"
            android:textSize="24sp" />
    </LinearLayout>

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

问题来自 LinearLayouts 上的 android:visibility="gone" 元素——出于某种原因,将可见性设置为消失会与 DrawerLayout 的逻辑冲突,以确定视图是否显示,因此它试图隐藏它。

将其从 XML 中删除会使所有内容看起来都一样(因为 DrawerLayout 查看 layout_gravity 来决定哪些子视图是抽屉并将它们自己隐藏)而不是有奇怪的跳跃。