原因是在有横划view 执行onInterceptTouchEvent
动作为scrollFling时候一般会调用getParent().requestDisallowInterceptTouchEvent(true);
来阻止父件的滚动,而在SwipeRefreshLayout
重写了该方法
@Override
public void requestDisallowInterceptTouchEvent(boolean b) {
// if this is a List < L or another view that doesn't support nested
// scrolling, ignore this request so that the vertical scroll event
// isn't stolen
if ((android.os.Build.VERSION.SDK_INT < 21 && mTarget instanceof AbsListView)
|| (mTarget != null && !ViewCompat.isNestedScrollingEnabled(mTarget))) {
// Nope.
} else {
super.requestDisallowInterceptTouchEvent(b);
}
}
mTarget是SwipeRefreshLayout的直接子View。解决办法是直接子View能嵌套滚动.满足ViewCompat.isNestedScrollingEnabled(mTarget)
网友评论