【发布时间】:2016-06-16 18:01:45
【问题描述】:
我正在为我的活动设计横向布局。在横向活动中,我碰巧有下面带有 xml 代码的布局。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="200dp"
android:background="@android:color/holo_blue_bright"
android:layout_height="match_parent"/>
<android.support.v4.widget.DrawerLayout
android:layout_width="200dp"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:background="@android:color/darker_gray"
android:layout_height="match_parent"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_gravity="end"
android:background="@android:color/holo_red_light"
android:layout_height="match_parent"/>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
这里出现的问题是抽屉没有通过边缘滑动打开。顺便说一句,使用 LTR 布局,所以 end 是正确的。通过java调用打开抽屉,抽屉打开和触摸事件也被处理。此外,所有抽屉也都已解锁。但是当抽屉布局是水平方向的线性布局的子布局时,抽屉仍然不会通过从右边缘滑动打开。如果 linearLayout 中的第一个 Frame:ayout 宽度为零,则抽屉可以工作。
抽屉布局有什么问题?我该如何解决这个问题?
【问题讨论】:
标签: android android-layout drawerlayout viewgroup