abstract:public boolean onTouchEvent(MotionEvent event) { //获取到手指处的横坐标和纵坐标 int x = (int) event.getX(); int y = (int) event.getY(); switch(event.getAction()){
public boolean onTouchEvent(MotionEvent event) {
//获取到手指处的横坐标和纵坐标
int x = (int) event.getX();
int y = (int) event.getY();
switch(event.getAction()){
case MotionEvent.ACTION_DOWN:
lastX = x;
lastY = y;
break;
case MotionEvent.ACTION_MOVE:
//计算移动的距离
int offX = x - lastX;
int offY = y - lastY;
offsetLeftAndRight(offX);
offsetTopAndBottom(offY);
break;
}
return true;
}
Correcting teacher:查无此人Correction time:2019-06-10 09:39:19
Teacher's summary:完成的不错。js功能非常强大,要好好练习。继续加油。