문제

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...

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top