How to set a clickable region for an ImageView?

半世苍凉 提交于 2020-01-03 02:12:05

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!