I tried this code for drag and drop : https://github.com/iPaulPro/Android-ItemTouchHelper-Demo.
Here is a video : https://youtu.be/lMsv2jYpbi4
Is there a way to speed up the scrolling during drag-and-drop ?
In your class that extends ItemTouchHelper.Callback, override the method:
@Override
public int interpolateOutOfBoundsScroll(RecyclerView recyclerView, int viewSize, int viewSizeOutOfBounds, int totalSize, long msSinceStartScroll) {
final int direction = (int) Math.signum(viewSizeOutOfBounds);
return 10 * direction;
}
This is a simple example which uses a fixed scroll speed, but if you wanted something that started slow and sped up (like the super.interpolateOutOfBoundsScroll does) you can do some maths based on the time since scrolling (msSinceStartScroll) and also the position in the overall scroll (example scroll faster when in the middle of the scroller and slower when you near the start/end).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With