的onTouchEvent()与onTouch() [英] onTouchevent() vs onTouch()

查看:137
本文介绍了的onTouchEvent()与onTouch()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

许多实验的onTouchEvent和onTouch后,我发现onTouch工作无处不在,你想要的(无论是活动或视图),只要您已声明的接口,并把监听器吧!而另一方面,的onTouchEvent只能内查看! 是我的假设是否正确?这才是真正的区别是什么?

After many experiments with onTouchEvent and onTouch, I found that onTouch works everywhere you want (whether it is in activity or view) as long as you have declared the interface and put the Listener right! On the other hand, onTouchEvent only works inside a View! Is my assumption correct? Is this the real difference?

推荐答案

是的,你是正确的 - onTouch()所使用的用户的在查看来获取触摸事件,而的onTouchEvent()所使用的派生类查看来获取触摸事件。

Yes you are correct - onTouch() is used by users of the View to get touch events while onTouchEvent() is used by derived classes of the View to get touch events.

这篇关于的onTouchEvent()与onTouch()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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