onInterceptTouchEvent(MotionEvent ev)

onInterceptTouchEvent(MotionEvent ev)方法是GroupView控件中特有的一个方法,我们可以实现这个方法来截获所有的窗口点击事件来根据事件的不同来对子控件或自身分发事件触发。覆盖这个方法时需要小心注意,因为它和View.onTouchEvent(MotionEvent)有着复杂的关系,我们使用是需要和View.onTouchEvent(MotionEvent)一同实现来达到正确的结果,事件触发顺序如下:

1.你首先会在该方法中得到一个down事件。

2.这个down事件会被得到处理,要么在这个GroupView中子控件的onTouchEvent()方法中,要么在GroupView自身的onTouchEvent()方法中。当我们在onTouchEvent()方法返回值中返回true的话,将会继续看到后续的触发事件(move、up等),要注意的是当我们在GroupView的onTouchEvent()事件返回值中返回true的话,该方法将不再捕获后续的(move up)事件。

3.如果在该方法返回值中返回false,down事件将根据控件树结构从根节点向目标子控件的onTouchEvent()方法分发。

4.如果在该方法返回值中返回true,那么你的子控件将获取不到任何点击事件。

via http://blog.csdn.net/ym19860303/article/details/7724944

http://blog.csdn.net/aomandeshangxiao/article/details/7452890 代码片断有用

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: