0

I have 3 recycler view, when one is scrolling the two others scroll in same time, I'm using a OnScrollListener for doing it

    @Override
    public void onScrolled(RecyclerView recyclerView, final int dx, final int dy) {
             super.onScrolled(recyclerView, dx, dy);
                  recyclerView2.removeOnScrollListener(this);
                  recyclerView3.removeOnScrollListener(this);
                  recyclerView2.scrollBy(dx , 0);
                  recyclerView3.scrollBy(dx , 0);
                  recyclerView2.addOnScrollListener(this);
                  recyclerView3.addOnScrollListener(this);
     }

This is working fine but I would like that the recyclerView2 and recyclerView3 decelerate when scrolling

I try to use fling()

recyclerView1.setOnFlingListener(new RecyclerView.OnFlingListener() {

         @Override
         public boolean onFling(int velocityX, int velocityY) {
              recyclerView2.fling(40* (int) Math.signum((double)velocityX), velocityY);
              recyclerView3.fling(60* (int) Math.signum((double)velocityX), velocityY);
              return true;     
         }
});

This decelerate the 3 recycler instead of decelerate only the recyclerView2 and recyclerView3

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Robert Tripoux
  • 127
  • 1
  • 10
  • Maybe is related to this question https://stackoverflow.com/questions/30702726/sync-scrolling-of-multiple-recyclerviews – 4gus71n Jul 06 '18 at 13:53
  • Nope this question issue is solve in my case, my trouble is just to decelerate other recyclerview – Robert Tripoux Jul 06 '18 at 13:55
  • but... doesn't fling automatically decelerate? Why not keep the onscroll listener for recycler view 1 and instead of scrolling the other recycler views, you just call those 2 fling methods you have there? – Fred Jul 06 '18 at 16:32

0 Answers0