2

I'm trying to limit the fling speed of the recycleview.

I see RecycleView has this method:

public boolean fling(int velocityX, int velocityY) {
...
}

However this deals with an internal private class ViewFlinger. Not to mention only called once with the initial velocities.

I also noticed there's an OnFlingListener which has both arguments: velocityX, velocityY. If you set this and return true from the method, fling wont work at all:

recycleView.setOnFlingListener(new RecyclerView.OnFlingListener() {
        @Override
        public boolean onFling(int velocityX, int velocityY) {
            return true;
        }
    });

But this is not what I want. I want neither.

I'd like to cap the top speed of the fling but still keep it going.

Any ideas how to solve this?

Tom11
  • 2,419
  • 8
  • 30
  • 56
breakline
  • 5,776
  • 8
  • 45
  • 84
  • So overriding of the fling method doesn't help? I mean you can extend RecycleView and override method like: public boolean fling(int velocityX, int velocityY) { super.fling(Math.Min(velocityX, 1000), Math.Min(velocityY, 1000)); } – Volodymyr Baydalka Sep 08 '16 at 11:10
  • I had the same problem and this answer did the trick https://stackoverflow.com/a/47596874/8647537 – Taha Malik Feb 10 '19 at 19:35

0 Answers0