【android】说说GestureDetector.OnGestureListener onScroll函数
16lz
2021-01-23
public abstract booleanonScroll(MotionEvente1,MotionEvente2, float distanceX, float distanceY)
Since: API Level 1 Notified when a scroll occurs with the initial on downMotionEvent
and the current moveMotionEvent
. The distance in x and y is also supplied for convenience.
Parameters
e1 | The first down motion event that started the scrolling. |
---|---|
e2 | The move motion event that triggered the current onScroll. |
distanceX | The distance along the X axis that has been scrolled since the last call to onScroll. This is NOT the distance betweene1 ande2 . |
distanceY | The distance along the Y axis that has been scrolled since the last call to onScroll. This is NOT the distance betweene1 ande2 . |
Returns
- true if the event is consumed, else false
验证:
if (lastE2 != null){ Log.i(TAG, "distanceX:" + distanceX + " = " + (lastE2.getX()-e2.getX())); Log.i(TAG, "distanceY:" + distanceY + " = " + (lastE2.getY()-e2.getY()));}lastE2 = MotionEvent.obtain(e2);
更多相关文章
- Android下openGL操作矩阵的函数
- Android中常用的函数
- Android下intent的setdata、settype和setdataandtype函数
- C基础—函数指针,联合体,枚举,结构体和结构体指针
- OpenCV 的 RGB 顺序和 Android 载入的 RGB 顺序相反
- Android的按钮监听事件&自定义回调函数
- android JNI层线程回调Java函数
- 硬件访问服务4之Android硬件访问服务框架及系统函数全详细实现
- 重载android返回键响应函数