0

当我触摸屏幕时,我有以下处理方法:

public boolean onTouchEvent(MotionEvent event) {

    boolean touchDown = true;
    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            Log.i(TAG,"touching the screen: YES");
        case MotionEvent.ACTION_UP:
            touchDown = false;
            Log.i(TAG,"touching the screen: NO");
    }
    return touchDown;

}

当我在不移开手指的情况下触摸屏幕时,Logcat 的结果是:

touching the screen: YES
touching the screen: NO

在我从屏幕上松开手指之前,我不想显示第二个日志。

我做错了什么?

谢谢。

4

1 回答 1

5

在第一种(和第二种)情况下,您需要 a break;。我也被它刺痛了。:)

于 2011-02-22T20:22:25.467 回答