如何在触摸屏时保留onTouchEvent?

kar*_*e23 0 java android touch-event

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

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;

}
Run Code Online (Sandbox Code Playgroud)

当我触摸屏幕而不移开手指时Logcat的结果是:

touching the screen: YES
touching the screen: NO
Run Code Online (Sandbox Code Playgroud)

直到我从屏幕上释放myfinger,我才想要显示第二个日志.

我做错了什么?

谢谢.

Blu*_*mer 5

break;在第一个(和第二个)案例中你需要一个.我也受到了刺痛.:)