SwipeToRefresh 不遵守 Android 中的 requestDisallowInterceptTouchEvent()
SwipeToRefresh does not respect requestDisallowInterceptTouchEvent() in Android
我正在尝试在 RecyclerView
项内实现水平滚动。除一个问题外,一切正常。当垂直 RecyclerView
处于最顶部位置(它被包裹在 SwipeRefreshLayout
中)并且用户开始水平拖动然后向下移动手指时它会启动 SwipeToRefresh 手势(小圆圈开始出现)。我试过像描述的那样使用 requestDisallowInterceptTouchEvent(true)
here but it does not help. So what I figured out is SwipeRefreshLayout
does not respect requestDisallowInterceptTouchEvent()
method. As you can see here 它阻止了 ViewGroup
的行为:
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
// Nope.
}
是否可以将此更改为调用 super.requestDisallowInterceptTouchEvent(b)
?例如使用反射 api ?
P.S。它不像范围 SwipeRefreshLayout 和覆盖方法那么简单,因为它在第三方库中...
您可以暂时禁用它。
mPullToRefreshLayout.setEnabled(false);
版本 1.2.0-alpha01 现在支持 requestDisallowInterceptTouchEvent()
我正在尝试在 RecyclerView
项内实现水平滚动。除一个问题外,一切正常。当垂直 RecyclerView
处于最顶部位置(它被包裹在 SwipeRefreshLayout
中)并且用户开始水平拖动然后向下移动手指时它会启动 SwipeToRefresh 手势(小圆圈开始出现)。我试过像描述的那样使用 requestDisallowInterceptTouchEvent(true)
here but it does not help. So what I figured out is SwipeRefreshLayout
does not respect requestDisallowInterceptTouchEvent()
method. As you can see here 它阻止了 ViewGroup
的行为:
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
// Nope.
}
是否可以将此更改为调用 super.requestDisallowInterceptTouchEvent(b)
?例如使用反射 api ?
P.S。它不像范围 SwipeRefreshLayout 和覆盖方法那么简单,因为它在第三方库中...
您可以暂时禁用它。
mPullToRefreshLayout.setEnabled(false);
版本 1.2.0-alpha01 现在支持 requestDisallowInterceptTouchEvent()