Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hilfritz/2a570deb5934ef4e4b06e13abb7aa736 to your computer and use it in GitHub Desktop.

Select an option

Save hilfritz/2a570deb5934ef4e4b06e13abb7aa736 to your computer and use it in GitHub Desktop.
Android: Recyclerview inside Scrollview - Scroll problem
//issue happens one pre lolipop devices
//https://stackoverflow.com/questions/27083091/recyclerview-inside-scrollview-is-not-working
//must use NestedScrollView
fix:
mRecyclerView.addOnItemTouchListener(new RecyclerView.OnItemTouchListener() {
@Override
public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
int action = e.getAction();
switch (action) {
case MotionEvent.ACTION_MOVE:
rv.getParent().requestDisallowInterceptTouchEvent(true);
break;
}
return false;
}
@Override
public void onTouchEvent(RecyclerView rv, MotionEvent e) {
}
@Override
public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment