1

I use smooth recyclerView.smoothScrollBy(int dx , int dy) for scrolling. Put this method in handler and call the handler every 50 miliseconds. my speed range is 0 - 10. Runnable of handle scrolling is

   private Runnable runnableMove = new Runnable() {
    @Override
    public void run() {
        recyclerView.smoothScrollBy(0,speed * 4);
        handler.postDelayed(this,50);   
   };

Suddenly scrolling starts to lagging. And i must stop scrolling and start it again.

This is important and I sync 2 device and more (maybe 4 , 5) with the same item in recycler view and I need the scroll position of any of them to sync them together.

Most of the time one or two of the devices is slower or faster in scrolling. I need all device scroll with the same speed. How can I solve this problem in android.

sinek
  • 2,458
  • 3
  • 33
  • 55
Ali Elahi
  • 131
  • 1
  • 10

2 Answers2

1

You could try to use an ObjectAnimator.

ObjectAnimator.ofInt(recyclerView, "scrollY", 1000).setDuration(12000).start()

Start this simultaneously on all devices and they should be in sync without any lag.

Manaus
  • 407
  • 5
  • 9
ChristianoBolla
  • 538
  • 1
  • 5
  • 20
1

I found this method and it works for me:

recyclerView.smoothScrollBy(dx, dy, new LinearInterpolator(), time);
Ali Elahi
  • 131
  • 1
  • 10