垂直滚动打断过分敏感DrawerLayout用ListFragment使用DrawerLayout当 [英] Vertical Scrolling Interrupted by Oversensitive DrawerLayout When Using DrawerLayout with a ListFragment

查看:181
本文介绍了垂直滚动打断过分敏感DrawerLayout用ListFragment使用DrawerLayout当的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用DrawerLayout具有一个ListView滑出式片段显示两个片段。我主要是下面的开发者网站发现的例子。

I'm attempting to use the DrawerLayout to display two fragments with the slideout fragment having a listview. I'm mostly following the example found on the developers site.

我把一切都几乎工作,但通过列表视图滚动时,在滚动运动的左边或右边的动作会造成滚动被打断和drawerLayout水平移动。

I have everything almost working, however when scrolling through the listview, any left or right movements in the scrolling motion will cause the scrolling to be interrupted and the drawerLayout to move horizontally.

布局

             fragment A
-------------------------------------
|                       |            |
|                       |            |
|                       |            |
|   Content Fragment    | Fragment A | 
|                       |            |
|                       | (ListView) |
|                       |            |
|                       |            |
|                       |            |
--------------------------------------

我Activity.xml

My Activity.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

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我没有这个问题,有没有办法从,而我的列表视图当前的滚动射击停止DrawerLayouts onTouch事件?我试过设置设置我的片段的rootview是点击= true,这没有奏效。

I don't have this problem if I use a normal ListView with the DrawerLayout, is there a way to stop the DrawerLayouts onTouch events from firing while my Listview is currently scrolling? I've tried setting setting my Fragment's rootview to be clickable = true, which didn't work.

任何建议将大大AP preciated!

Any suggestions would greatly be appreciated!

推荐答案

原来,SwipeRefreshLayout引起了我的滚动发行。拆除的布局和使用一个单独的第三方库解决了该问题对我来说。

It turns out the SwipeRefreshLayout was causing my scrolling issue. Removing the layout and using a separate 3rd party library fixed the issue for me.

下面是对SwipeRefreshLayout开放门票:的https:/ /$c$c.google.com/p/android/issues/detail?id=69074

Here's an open ticket on the SwipeRefreshLayout: https://code.google.com/p/android/issues/detail?id=69074

这篇关于垂直滚动打断过分敏感DrawerLayout用ListFragment使用DrawerLayout当的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆