当手指在左右方向缓慢拖动时,我想使用onScroll方法 前进或后退视频。还有onfling方法,当手指在 向左或向右方向播放下一个或上一个视频。基本上,我想实现这些 方法取决于手指的速度。例如,假设拖动速度为500,则当 当速度大于500时,请使用onfling;当速度小于500时,请使用onScroll方法。 如何实现呢?
@Override
public boolean onScroll(MotionEvent e1,MotionEvent e2,float distanceX,float distanceY) {
// use on scroll when moving finger with low velocity,such as when using media player to
//forward video
return super.onScroll(e1,e2,distanceX,distanceY);
}
@Override
public boolean onfling(MotionEvent e1,float velocityX,float velocityY) {
// use on fling when moving finger with high velocity
return super.onfling(e1,velocityX,velocityY);
}