Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.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以编程方式进行多点触摸(不是多点触摸屏幕上的一个手指)_Android_Touch - Fatal编程技术网

Android以编程方式进行多点触摸(不是多点触摸屏幕上的一个手指)

Android以编程方式进行多点触摸(不是多点触摸屏幕上的一个手指),android,touch,Android,Touch,我想知道是否有可能用一次触摸做多个触摸。 就像用鼠标点击一个按钮 提前感谢为了检测双击,您需要使用手势检测器。请参见此示例: public class MyView extends View { GestureDetector gestureDetector; public MyView(Context context, AttributeSet attrs) { super(context, attrs); // creating new gesture d

我想知道是否有可能用一次触摸做多个触摸。 就像用鼠标点击一个按钮


提前感谢

为了检测双击,您需要使用手势检测器。请参见此示例:

 public class MyView extends View {
GestureDetector gestureDetector;

public MyView(Context context, AttributeSet attrs) {
    super(context, attrs);
            // creating new gesture detector
    gestureDetector = new GestureDetector(context, new GestureListener());
}

// skipping measure calculation and drawing

    // delegate the event to the gesture detector
@Override
public boolean onTouchEvent(MotionEvent e) {
    return gestureDetector.onTouchEvent(e);
}


private class GestureListener extends GestureDetector.SimpleOnGestureListener {

    @Override
    public boolean onDown(MotionEvent e) {
        return true;
    }
    // event when double tap occurs
    @Override
    public boolean onDoubleTap(MotionEvent e) {
        float x = e.getX();
        float y = e.getY();

        Log.d("Double Tap", "Tapped at: (" + x + "," + y + ")");

        return true;
    }
}
}

你指的是双击还是双击?双击。我在Google play搜索了一下是否有应用程序,但什么都没有。我想点击屏幕一次并发送更多可能的副本我不清楚我不想检测到双击我想做两次三次等。。用一个水龙头轻敲。所以当我一次触摸屏幕时,系统会收到2条或更多触摸命令。。。我懂了。。。你想强迫一个假双击进入系统管道。。。。不幸的是,我不知道任何解决办法!抱歉…尽管这可能会有所帮助: