Frage

I have implemented SimpleOnGestureListener.onFling(), but I have to fling very fast to trigger it. Is there any way to make it more sensitive?

Thanks in advance...

War es hilfreich?

Lösung

The sensitivity or "oomph" needed to trigger an onFling() event is checked here in GestureDetector:

if ((Math.abs(velocityY) > mMinimumFlingVelocity)
        || (Math.abs(velocityX) > mMinimumFlingVelocity)){
    handled = mListener.onFling(mCurrentDownEvent, ev, velocityX, velocityY);
}

Sadly there is no existing method to change the private member mMinimumFlingVelocity. However you should be able to copy the entire GestureDetector class into a new class in your project and hard code a new value yourself.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top