문제

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?

도움이 되었습니까?

해결책 2

android works as described here

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top