什么原因导致Android中的MotionEvent.ACTION_CANCEL? [英] What causes a MotionEvent.ACTION_CANCEL in Android?

查看:446
本文介绍了什么原因导致Android中的MotionEvent.ACTION_CANCEL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过调试Android上的一些触摸处理工具,并试图找出为什么MotionEvent发送到我的View的 onTouchListener 包含一个取消<动作。我没有找到任何文件的原因,希望有人能指出我正确的方向来调试这个问题 - 错误代码,源代码或一般知识。

解决方案

这是你正在寻找的:



ACTION_CANCEL发生在父母拥有动议时,
,例如当用户已经在列表视图中拖动足够的时候,
开始滚动,而不是让它按下它内的按钮
您可以在视图组中找到更多信息文档: onInterceptTouchEvent



希望这是您正在寻找的答案:



资源:运动事件堆栈溢出


I am working through debugging some touch handling stuff on Android, and am trying to figure out why the MotionEvent sent to my View's onTouchListener contains a cancel action. I have not been able to find any documentation on its cause, and was hoping someone could point me in the right direction for debugging this problem - error codes, source code, or some general knowledge.

解决方案

Is this what you are looking for:

"ACTION_CANCEL occurs when the parent takes possession of the motion, for example when the user has dragged enough across a list view that it will start scrolling instead of letting you press the buttons inside of it. You can find out more about it at the viewgroup documentation: onInterceptTouchEvent."

Hope that is the answer you are looking for:

Resources: Motion Event, Stack Overflow.

这篇关于什么原因导致Android中的MotionEvent.ACTION_CANCEL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆