【发布时间】:2012-03-22 16:41:22
【问题描述】:
无论如何我可以调整 setOnTouchListner 的灵敏度。目前它在每次触摸时输入多个值..谢谢!
【问题讨论】:
标签: android view touch-event ontouchlistener
无论如何我可以调整 setOnTouchListner 的灵敏度。目前它在每次触摸时输入多个值..谢谢!
【问题讨论】:
标签: android view touch-event ontouchlistener
如果你只需要注册一个触摸,你可以使用这样的东西:
boolean taped=false;
public boolean onTouch(View v, MotionEvent event){
switch(event.getAction() & MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_DOWN:
if(!taped){
//do your stuff
}else taped=true;
break;
case MotionEvent.ACTION_UP:
taped=false;
break;
}
return false;
}
【讨论】: