[英]How to retain onTouchEvent while touching 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;
}
当我不移动手指就触摸屏幕时,Logcat的结果是:
touching the screen: YES
touching the screen: NO
在从屏幕上释放myfinger之前,我不希望显示第二个日志。
我做错了什么?
谢谢。
你需要break;
在您的第一个(和第二个)案例中。 我也为此感到ung恼。 :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.