How do I finish tracking ACTION_MOVE in android?

时间:2015-05-12 23:00:35

标签: android ontouchlistener motionevent

As I know, if my myFun1 <- function() { compVal <<- 2*3 } method returns onTouch, after the initial ACTION_DOWN case it does not start tracking the movement, and if I return false, it does. But I have some cases when I need to stop tracking the movement from some moment. How do I achieve this? I tried to returning false when my condition holds, but it continues to run into that case. How to cancel or stop the motion event?

Here is the code I have for my drag and drop application, and when the X is less than 100, I just want to stop dragging. How can I achieve this?

true

Thanks in advance.

1 个答案:

答案 0 :(得分:0)

如果img位于x的100位置然后又回来了怎么办? 一种方法是一起禁用touchevent,但那么你将如何获得下一个touchevent?除非它将成为另一个将接收触摸事件的视图,无论如何,如果您停止触摸事件,您将再次收到任何触摸事件,如果这是您希望得到的,只需禁用这个视图的touchevent,你可以选择再次启用它,祝你好运! :)