Android 多点触控和双击协同工作以实现图像视图
你好 我在 LinearLayout(垂直方向)中有两个图像视图。我正在为两个 Imageview 设置 setOnTouchListener 。 这样我就能够观察多点触摸缩放以及 ImageView 的所有拖动。 当我尝试实现 OnDoubletapListener 时,问题就出现了。 OnDoubleTapListener 仅在不使用 setOnTouchListener 的情况下工作。
但是,如果我评论 setOnTouchListner 那么我就可以执行双击。
这两个功能不能同时工作吗???
如果您愿意,我也可以提供源代码.. 请帮助
Ankit Verma
Hi
I have two imageviews in a LinearLayout(Vertical orientation). I am setting setOnTouchListener for both the Imageviews.
This way i am able to observe the Multi touch zoom as well as all the dragging of the ImageViews.
The problem comes when i try to implement OnDoubletapListener.
OnDoubleTapListener works only without the use of setOnTouchListener.
However if i comment the setOnTouchListner then i am able to perform Double Tap..
Can't the two feartures work simultaneously?????
If You want i can provide the source code as well..
Pl Help
Ankit Verma
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我也遇到过同样类型的问题....我用这种方式解决...
如果你使用 android mutitouch 控制器 http://code.google.com/p/android-multitouch-controller/ 用于多点触控
和 GestureDetector http://www.41post.com/4194/programming/android-detecting-double-tap-events 用于双击
而不是
更新此MultiTouchController.java 中的步骤
-->导入
-->实施
-->
-->在 onTouch(MotionEvent event) 处将触摸事件设置为 gd
不要在任何其他文件中进行更改。
现在测试...希望你解决问题...必须回复...
I had also face that same type problem....I solve with this way...
If You using android mutitouch controller http://code.google.com/p/android-multitouch-controller/ for multitouch
and GestureDetector http://www.41post.com/4194/programming/android-detecting-double-tap-events for double tap
than
update this steps in MultiTouchController.java
--> import
--> implement
-->
--> set touch event to gd at onTouch(MotionEvent event)
Don't change in any other files.
Now test...Hope you solved problem...must reply...
嘿,我不知道你是否仍然遇到同样的问题,但我找到了一种方法来解决它。事实上,我只是为多点触摸事件实现了 OnTouchListner,并测量了两次调用 ACTION_DOWN 之间的时间。如果该时间小于某个值,我认为这是双击,并相应地执行操作。希望有帮助。如果您找到了同时实现 OnTouchListner 和 GestureDetector.OnDoubleTapListener 的方法,请告诉我!
Hey I don't know if you are still stuck with the same problem but I found a way to get around it. In fact, I just implement the OnTouchListner for the multitouch events and I measure the time between two calls to ACTION_DOWN. If that time is smaller than a certain value, I consider that this was a double touch and I perform the actions consequently. Hope that helps. If you found a way to implement both the OnTouchListner and the GestureDetector.OnDoubleTapListener please let me know!
请检查下面的链接,可能对您有帮助..implements GestureDetector
http://android-journey.blogspot.com/2010/01/android -gestures.html
GestureDetector.OnDoubleTapListener
{用于在双击或确认单击发生时发出通知的侦听器。 }
Please check below link , may be helpful to you ..implements GestureDetector
http://android-journey.blogspot.com/2010/01/android-gestures.html
GestureDetector.OnDoubleTapListener
{The listener that is used to notify when a double-tap or a confirmed single-tap occur. }