Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/352.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
Java 在Android中向视图添加双击侦听器_Java_Android_Android Edittext_Listener - Fatal编程技术网

Java 在Android中向视图添加双击侦听器

Java 在Android中向视图添加双击侦听器,java,android,android-edittext,listener,Java,Android,Android Edittext,Listener,我正在尝试在TextView上添加双击侦听器。我知道我可能需要使用手势检测器,但我不确定你是如何做到的 试试这个 // Instantiate the gesture detector with the // application context and an implementation of // GestureDetector.OnGestureListener mDetector = new GestureDetectorCompat(t

我正在尝试在TextView上添加双击侦听器。我知道我可能需要使用手势检测器,但我不确定你是如何做到的

试试这个

// Instantiate the gesture detector with the
        // application context and an implementation of
        // GestureDetector.OnGestureListener
        mDetector = new GestureDetectorCompat(this,this);
        // Set the gesture detector as the double tap
        // listener.
        mDetector.setOnDoubleTapListener(this);
或者使用给定的链接


这在活动上添加了一个手势检测器。我正试图将其添加到文本视图中