Found a way to force the scroll state to be idle.
Waiting for google to fix this bug.
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
boolean requestCancelDisallowInterceptTouchEvent = getScrollState() == SCROLL_STATE_SETTLING;
boolean consumed = super.onInterceptTouchEvent(event);
final int action = event.getActionMasked();
switch (action) {
case MotionEvent.ACTION_DOWN:
if( requestCancelDisallowInterceptTouchEvent ){
getParent().requestDisallowInterceptTouchEvent(false);
// only if it touched the top or the bottom. Thanks to @Sergey's answer.
if (!canScrollVertically(-1) || !canScrollVertically(1)) {
// stop scroll to enable child view to get the touch event
stopScroll();
// do not consume the event
return false;
}
}
break;
}
return consumed;
}
EDIT
The issue has been fixed in support library 27.0.1.
https://developer.android.com/topic/libraries/support-library/revisions.html#27-0-1
After a user scrolls, they cannot click on an item in a RecyclerView. (AOSP issue 66996774)
Updated on Nov 17, 2017
Some users reported that this problem is not fixed in support library 27.0.1.
The issue tracker is here.
https://issuetracker.google.com/issues/66996774
So you may choose to use this official workaround.
https://gist.github.com/chrisbanes/8391b5adb9ee42180893300850ed02f2
Or use this one here.