我在 Android 中的 MotionEvents 有以下代码:
@Override
public boolean onTouchEvent(MotionEvent event){
int action = event.getActionMasked();
switch (action){
case MotionEvent.ACTION_UP:
mGameview.moveUp(30);
break;
case MotionEvent.ACTION_DOWN:
mGameview.moveDown(30);
break;
}
return true;
}
然而,这些事情不仅在我向上/向下拖动手指时触发,而且无论我在应用程序中做什么,它们都会同时发生,例如当我点击、左右拖动时。