Reputation: 151
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
.
Upvotes: 1
Views: 1310
Reputation: 151
I found this method and it works for me:
recyclerView.smoothScrollBy(dx, dy, new LinearInterpolator(), time);
Upvotes: 2
Reputation: 658
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.
Upvotes: 1