我试图使用DrawerLayout来展示两个带有滑动列表的fragment。我大多数时候都在遵循开发者网站上找到的示例。
我已经几乎把一切都弄好了,但是当滚动列表时,任何左右移动的操作都会导致滚动被中断,并使DrawerLayout水平移动。
布局
如果我使用普通的ListView与DrawerLayout,就不会出现这个问题。有没有办法在我的ListView正在滚动时停止DrawerLayout的触摸事件?我尝试将我的Fragment的根视图设置为可点击=true,但没有起作用。
非常感谢您的任何建议!
我已经几乎把一切都弄好了,但是当滚动列表时,任何左右移动的操作都会导致滚动被中断,并使DrawerLayout水平移动。
布局
fragment A
-------------------------------------
| | |
| | |
| | |
| Content Fragment | Fragment A |
| | |
| | (ListView) |
| | |
| | |
| | |
--------------------------------------
我的活动.xml
<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">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<FrameLayout
android:id="@+id/drawer_right"
android:layout_width="320dp"
android:layout_height="match_parent"
android:layout_gravity="right"/>
</android.support.v4.widget.DrawerLayout>
FragmentA.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dp"
android:layout_height="match_parent"
android:background="@color/lightGray">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ExpandableListView
android:id="@+id/expandableListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:groupIndicator="@null"/>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
如果我使用普通的ListView与DrawerLayout,就不会出现这个问题。有没有办法在我的ListView正在滚动时停止DrawerLayout的触摸事件?我尝试将我的Fragment的根视图设置为可点击=true,但没有起作用。
非常感谢您的任何建议!