计算滑动速度的最佳方法是什么?是否有一些奇特的类或功能提供此功能,或者我是否需要通过测量触碰和触碰来执行此操作?我做了一些搜索,但一无所获——也许我没有正确的术语。
最佳答案
OnGestureListener
具有以下方法,提供 x 轴和 y 轴的速度:
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
您可以实现 OnGestureListener
,或者从文档中:
If you want to listen for all the different gestures then implement this interface. If you only want to listen for a subset it might be easier to extend GestureDetector.SimpleOnGestureListener.
关于安卓滑动速度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11351624/