我拼命想解决这个问题:只有 ACTION_DOWN 事件触发我的方法。一整天,它工作得很好,但现在它不再工作了,但我没有改变任何东西。
public boolean onTouch(View v, MotionEvent event) {
boolean isReleased = event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_CANCEL;
boolean isPressed = event.getAction() == MotionEvent.ACTION_DOWN;
boolean isMoved = event.getAction() == MotionEvent.ACTION_MOVE;
if(isPressed){
if(Gesture_Done){
reset_It();
}
xPressed = event.getX();
yPressed = event.getY();
action_timelist.add(System.currentTimeMillis());
if(action_timelist.size()>1){
evaluate_actionlist(true);
}
}
else if(isReleased){
if(!Gesture_Done){
action_timelist.add(System.currentTimeMillis());
evaluate_actionlist(false);
}
Gesture_Done=false;
}
else if(isMoved){
xMoved = xPressed - event.getX();
yMoved = yPressed - event.getY();
checkGesture();
}
return false;
}
因为没有显示错误,我不知道如何修复它..