4

I am facing a problem with Recyclerview inside Viewpager fragments.

I have two fragments and both loaded in ViewpagerAdapter. In the second fragment, I have a simple Horizontal Recyclerview. Initially, 1st fragment is loaded in ViewPager and when I swipe right to left on screen it will redirect me to the second fragment.

In the second fragment Recyclerview already loaded. But when I tried to scroll Recyclerview horizontally for more items it is not scrolling it redirects me to the 1st fragment from swipe left to right.

How to allow the user to view more items?

Help me with this problem. Thanks in advance.

MLavoie
  • 9,671
  • 41
  • 36
  • 56
RushDroid
  • 1,570
  • 3
  • 21
  • 46
  • did you enable nested scrolling? – Mohammed Atif Apr 04 '17 at 13:05
  • Overriding the recycler view's on touch event works as mentioned in this post: https://stackoverflow.com/questions/54269842/horizontal-recyclerview-inside-viewpager-is-not-scrolling – Andrew Jul 09 '21 at 23:11

1 Answers1

1

Try to enable Nested Scrolling for recyclerview

after initialising your recyclerview, add this line of code

your_recyclerview.setNestedScrollingEnabled(true);
emilpmp
  • 1,716
  • 17
  • 32