我的应用程序有一个
它看起来像这样:http://i.imgur.com/mhoJ7MZ.gifv 如视频所示,我尝试使用
是什么导致了这种奇怪的跳动?
我的活动XML如下,完整代码在这里。
DrawerLayout
,里面有两个抽屉,一个在左边用于导航,一个在右边用于通知。当应用程序冷启动时,我向左滑动抽屉时,右侧的抽屉从屏幕最左边跳到右边。它看起来像这样:http://i.imgur.com/mhoJ7MZ.gifv 如视频所示,我尝试使用
DrawerLayout
的isDrawerOpen
和isDrawerVisible
方法来查看它是否认为右边的抽屉已经打开了(因为似乎在打开左边的抽屉时“关闭”了右边的抽屉),但是我没有得到任何有用的信息。是什么导致了这种奇怪的跳动?
我的活动XML如下,完整代码在这里。
<?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>