问题描述
我使用由克里斯·巴内斯提供pullToRefreshLibrary。我的GridView这是containg数据的完整列表。我试图pullToRefreshGridViewActivity,但它太慢了,所以我试图用pullToRefreshScrollViewActivity在我的GridView控件来处理它。问题是,当我这样做,滚动视图处理所有触摸事件,我不能轻扫GridView控件。我需要将其锁定,并通过润色GridView控件。
这里是我的xml:
I am using pullToRefreshLibrary provided by Chris Banes. I have gridView which is containg whole list of data. I tried pullToRefreshGridViewActivity but it was too slow so I am trying to use pullToRefreshScrollViewActivity over my gridView to handle it. The problem is that when I do so, scrollView is handling all touch events and I cannot swipe over gridView. I need to lock it and pass touches to gridView.here is my 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>
我试图用滚动视图锁定:
I tried to lock scrollView with :
mScrollView.requestDisallowInterceptTouchEvent(true);
gridView.requestDisallowInterceptTouchEvent(true);
mScrollView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
});
mScrollView.setOnTouchListener(null);
但是,这些工作。我不能在这里使用自定义的滚动型覆盖onInterceptTouchEvent。
But none of these work. And I can't use here custom ScrollView to override onInterceptTouchEvent.
推荐答案
一个黑客可以使用被打开库,进入 PullToRefreshBase.java
并删除最后
onInterceptTouchEvent >。然后,您可以使用自定义滚动型。
One hack you can use is to open the library, go into PullToRefreshBase.java
and remove final
from methods like onInterceptTouchEvent
. You can then use a custom ScrollView.
这篇关于如何从听触摸禁用pullToRefreshScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!