I am building a custom android control extending Gallery. I need an effect of views being overlaid so I am issuing
setSpacing(-60);
Once I give this, I have three icons in the Gallery, 1, 3 drawn first and then 2 which is the center one. The rules of the same is defined in getChildDrawingOrder
and also have enabled it by
setChildrenDrawingOrderEnabled(true);
Now the issue is the views are getting drawn in the way I have defined the rules in ordering. But the events in the gallery control are going to the original view order i.e. 1,2,3. To explain better,
1 is drawn, 3 is drawn and finally 2 is drawn, and they overlap each other. So the view has 50% of 1, 100% of 2 and 50% of 3rd view.
But when I touch the views, android assumes that 50% of 1, 50% of 2 and 100% of 3 is visible on the screen. To clarify a bit more, after 50% of 1 view, if I click, 2 gets focussed (which is the way it should, because as per my drawing rule, 2 is on top of 1).
But when I click anywhere after 50% of view 2, the focus goes to 3, while as per the order of drawing 3 is not visible there, 100% of 2 is visible, but for 50% of area of view 1, the focus is view 2.
Can you please help in sharing your thoughts on how we can solve it by forcing the order of events to follow the pattern of view on the screen?