java - 将双击监听器添加到 Android 中的 View

标签 java android android-edittext listener

我正在尝试在 TextView 上添加双击监听器。我知道我可能必须使用 GestureDetector,但我不太确定你是如何做到这一点的。

最佳答案

试试这个

// 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);

或使用给定的链接。

http://www.techotopia.com/index.php/Detecting_Common_Gestures_using_the_Android_Gesture_Detector_Class

关于java - 将双击监听器添加到 Android 中的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45384799/

相关文章:

java - 如何使用 Java 自动化质询-响应身份验证

java - JAXB 向后兼容性

php - 返回意外消息的 JSON(或 PHP)

android - 防止用户在 EditText 框中达到大小限制后插入更多字符

java - 在 EditText 和键盘之间添加边距

android - Edittext inputType ="textCapCharacters"不适用于 Android 4.0+?

java - 在java中迭代2个映射

java - CAS 和 SAML2 SSO 示例

java - 已经为此实例调用了 setRenderer

android - 在 android smack 4.1 中接收重复消息