I have 2 ImageViews which have AnimationDrawable backgrounds to animate a box opening and closing when you click on it. The 2 images are slightly overlapping (the transparent area) so they can be closer together.
The problem this is causing is that I am unable to click on regions of the 1st image where the 2nd image (transparent area) is overlapping.
Is there a way to set a clickable region of an ImageView?
I don't think that you can "define a clickable region on an ImageView" like you would do in HTML with a map. IMO the best you could do is draw a canvas on top of your ImageView
with the same size, and give it an onClick
method. Now, I don't know everything, so maybe I'm mistaken.
来源:https://stackoverflow.com/questions/3475350/how-to-set-a-clickable-region-for-an-imageview