[英]OnTouchEvent reacts multiple while touching the screen
I've got the problem, that the onTouchEvent reacts to staying with the finger on screen and move the finger. 我有一个问题,onTouchEvent会做出反应,让手指停留在屏幕上并移动手指。 That isn`t my aim.
那不是我的目标。 I want, that the OnTouchEvent only reacts if i tap on the screen, after this the OnTouchEvent should reactivate itself and the user have to click another time.
我希望OnTouchEvent仅在我点击屏幕时作出反应,此后OnTouchEvent应该重新激活自身,用户必须再次单击。
Anyone can solve my problem? 任何人都可以解决我的问题吗? I mean it's a little bit tricky with my timer, because i never leave the method OnTouchEvent.
我的意思是说我的计时器有点棘手,因为我从未离开过OnTouchEvent方法。
public boolean onTouchEvent(MotionEvent me){
if(!started){
started = true;
taptostart.setVisibility(View.GONE);
expla.setVisibility(View.GONE);
//start the timer
timer.schedule(new TimerTask() {
@Override
public void run() {
handler.post(new Runnable() {
@Override
public void run() {
changePos();
}
});
}
}, 0, 20);
}else{
activateHo();
}
return false;
}
public boolean onTouchEvent(MotionEvent me){
if(me.getAction() == MotionEvent.ACTION_DOWN){
//Do what you want here, when the view is touched
}
return false;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.