Question

I've got two views (one derived from SurfaceView another from ImageView) each encapsulated in a frame layout, and each view implements an ontouchlistener, which is set as the ontouchlistener of the view itself. These two views(layouts) have no intersection on the screen.

However, I cannot get these two listeners work together.

For example, if there is an ACTION_DOWN on view A (listener A), then listener B will not react (not events dispatched to B even the following motion is on view B), only listener A reacts until there is no touch events.

That is to say, even listener A is only set as the ontouchlistener for view A, it'll handle every event on the entire screen,and other listeners are inhibited.

That's strange to me, any explanations? Can two ontouchlisteners exist together in on screen?

Was it helpful?

Solution 2

android works as described here

OTHER TIPS

Of course they can, like two buttons with their own listeners. Try to set listeners to your views:

frameLayout.setOnClickListener();
imageView.setOnClickListener();

This way they should only react on events coming to their own listeners. Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top