[英]How to retain onTouchEvent while touching screen?
I have the following method to handle when I touch the screen: 触摸屏幕时,有以下方法可以处理:
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;
}
The result of the Logcat when I touch the screen without removing my finger is: 当我不移动手指就触摸屏幕时,Logcat的结果是:
touching the screen: YES
touching the screen: NO
I don't want show the second log until I release myfinger from the screen. 在从屏幕上释放myfinger之前,我不希望显示第二个日志。
What I'm doing wrong? 我做错了什么?
Thanks. 谢谢。
You need a break;
你需要
break;
in your first (and second) case. 在您的第一个(和第二个)案例中。 I've been stung by that, too.
我也为此感到ung恼。 :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.