我正在使用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>
我试图用以下方法锁定scrollView:
mScrollView.requestDisallowInterceptTouchEvent(true);
gridView.requestDisallowInterceptTouchEvent(true);
mScrollView.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
return false;
}
});
mScrollView.setOnTouchListener(null);
但这些都不起作用。我不能在这里使用自定义ScrollView来覆盖onInterceptTouchEvent。
答案 0 :(得分:0)
您可以使用的一种方法是打开图书馆,进入PullToRefreshBase.java
并从final
等方法中删除onInterceptTouchEvent
。然后,您可以使用自定义ScrollView。