Last active
September 25, 2018 09:58
-
-
Save hilfritz/2a570deb5934ef4e4b06e13abb7aa736 to your computer and use it in GitHub Desktop.
Android: Recyclerview inside Scrollview - Scroll problem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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