Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Android中调整setOnTouchListner的灵敏度_Android_View_Touch Event_Ontouchlistener - Fatal编程技术网

在Android中调整setOnTouchListner的灵敏度

在Android中调整setOnTouchListner的灵敏度,android,view,touch-event,ontouchlistener,Android,View,Touch Event,Ontouchlistener,我可以调整setOnTouchListner的灵敏度吗。目前,每次触摸都会输入多个值。谢谢 如果您只需要注册一次触摸,您可以使用以下内容: boolean taped=false; public boolean onTouch(View v, MotionEvent event){ switch(event.getAction() & MotionEvent.ACTION_MASK){ case MotionEvent.ACTION_DOWN:

我可以调整setOnTouchListner的灵敏度吗。目前,每次触摸都会输入多个值。谢谢

如果您只需要注册一次触摸,您可以使用以下内容:

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;
}

@用户1163234,则应改为设置OnClickListener