Android 如何禁用pullToRefreshScrollView听触摸

Android 如何禁用pullToRefreshScrollView听触摸,android,scrollview,pull-to-refresh,Android,Scrollview,Pull To Refresh,我正在使用Chris Banes提供的pullToRefreshLibrary。我有gridView,它包含整个数据列表。我尝试了pullToRefreshGridViewActivity,但速度太慢,因此我尝试在gridView上使用pullToRefreshScrollViewActivity来处理它。问题是,当我这样做时,scrollView正在处理所有触摸事件,而我无法在gridView上滑动。我需要锁定它并将触摸传递给gridView。 以下是我的xml: <com.handma

我正在使用Chris Banes提供的pullToRefreshLibrary。我有gridView,它包含整个数据列表。我尝试了pullToRefreshGridViewActivity,但速度太慢,因此我尝试在gridView上使用pullToRefreshScrollViewActivity来处理它。问题是,当我这样做时,scrollView正在处理所有触摸事件,而我无法在gridView上滑动。我需要锁定它并将触摸传递给gridView。 以下是我的xml:

<com.handmark.pulltorefresh.library.PullToRefreshScrollView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/pull_refresh_scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        ptr:ptrAnimationStyle="flip" >

        <com.asd.android.dda.ui.controls.ExpandableGridView
            android:id="@+id/gridview"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clipToPadding="false"
            android:drawSelectorOnTop="true"
            android:fadingEdge="none"
            android:gravity="top"
            android:horizontalSpacing="@dimen/image_grid_hspacing"
            android:listSelector="@drawable/selector_shadow"
            android:numColumns="@integer/grid_num_cols"
            android:paddingBottom="50dp"
            android:scrollbarAlwaysDrawVerticalTrack="false"
            android:scrollbars="none"
            android:scrollingCache="true"
            android:smoothScrollbar="false"
            android:stretchMode="columnWidth"
            android:verticalSpacing="@dimen/image_grid_vspacing"
            android:visibility="visible" />
    </com.handmark.pulltorefresh.library.PullToRefreshScrollView>

但这些都不管用。我不能在这里使用自定义滚动视图来覆盖onInterceptTouchEvent。

您可以使用的一种方法是打开库,进入
PullToRefreshBase.java
并从
onInterceptTouchEvent
等方法中删除
final
。然后可以使用自定义滚动视图。

定义“太慢”。这听起来很奇怪,因为它应该是为这种用途而设计的。它是一个相当大的数据库,包含图像,两个连续的图像,还有一个相当大的列表。我将它与GridView的pull-to-refresh实现进行了比较,它明显较慢。这可能是GridView风格的修改。这就是为什么我想使用ScrollView,我只想在用户位于GridView顶部时打开触摸屏。这个库似乎依赖于将GridView放在线性布局的框架布局中,原因很多,我不太明白。我要说的是,拉动刷新网格视图可能非常简单:当网格顶部已经显示时检测垂直拖动手势。这很奇怪,因为它会减慢滚动。我们在两个相同的Sgs2上检查了这一点,不幸的是出现了差异。
mScrollView.requestDisallowInterceptTouchEvent(true);
gridView.requestDisallowInterceptTouchEvent(true);

mScrollView.setOnTouchListener(new OnTouchListener(){ 
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return false; 
    }
});
mScrollView.setOnTouchListener(null);