我有一个应用程序,我想在其中实现一个双层抽屉-一个从左,一个从右。左边的抽屉用于应用程序导航,右边的抽屉用于结果过滤。
因此,布局是这样的:
<?xml version="1.0" encoding="utf-8"?>
<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">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/light_grey"
android:orientation="vertical">
<GridView
android:id="@+id/gridview"
style="@style/GridViewStyle"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:horizontalSpacing="7dp"
android:stretchMode="columnWidth"
android:verticalSpacing="7dp" />
</LinearLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
<ListView
android:id="@+id/right_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:background="#111"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>
你可以在这里清楚地看到"left_drawer“和"right_drawer",以及它们各自的重力-- "start”和"end“,这实际上是有效的!你可以把它们都拉出来。
问题是,当我实现DrawerToggle时-它只打开左边的抽屉,而不关闭右边的抽屉,所以如果打开右边的抽屉并按下DrawerToggle按钮-左边的抽屉也会打开,并与右边的抽屉重叠。
这里有几个我想要的解决方案:
我还没有想好如何做到这一点,因为DrawerToggle接受DrawerLayout本身作为参数,而不是各个抽屉……
我正在使用Support Library。
有谁有什么想法吗?提前谢谢你。
https://stackoverflow.com/questions/17861755
复制相似问题