先看效果图
关键代码(此处记录单点):
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
if (veloctiy==null) {
veloctiy=VelocityTracker.obtain();
}
veloctiy.addMovement(event);
break;
case MotionEvent.ACTION_MOVE:
veloctiy.addMovement(event);
veloctiy.computeCurrentVelocity(1000);
Log.i("lzh", veloctiy.getXVelocity()+"y:"+veloctiy.getYVelocity());
case MotionEvent.ACTION_UP:
veloctiy.clear();
break;
}
多点传递触点id,即可。