Click on overlapping gallery items

I have a gallery-based view with a negative spacing between the elements, so that one goes down after the previous one, i.e. "carousel". The scaling and carousel effect is achieved by transforming the camera.

The problem arises when I try to click the right side of the foreground element, and what I really get is a click on the element behind it (always to the right of it).

Let me calculate what I have already tried:

  • setChildrenDrawingOrderEnabled (true);
  • the z coordinate of the background element is obviously greater than one in the foreground
  • getChildDrawingOrder has been overridden in as many ways as possible (and I found out that it does not play any role at all - touch events do not depend on the order of visibility of the views)

It seems that the next (right) child object has a higher index and, therefore, the priority of processing user interface events, and my operations with the coordinates of the z-coordinate / drawing do not change anything.

So the question is: how to make the foreground object responsible for all click events on it?

+4
source share

All Articles