Android Best way to overlay an item in an ImageView

拟墨画扇 提交于 2020-01-03 05:28:10

问题


Any ideas on how to overlay a View over an ImageView? More specifically I would like to popover view when the user clicks in certain regions of my ImageView. I'm solving this problem drawing the popover view after the image in the onDraw() method but it has been a pain to handle events when the user clicks in the popover.

Thanks in advance


回答1:


FrameLayout resolves this problem. You can place two children inside the FrameLayout, where the first child will be the background and the second will be the foreground. Let your ImageView be in background, then you can place any other View and it will overlay the ImageView. Hope this helps.




回答2:


for overlaying views, you can wrap them in a FrameLayout. add first the ImaveView to it, then the overlay view.



来源:https://stackoverflow.com/questions/11658437/android-best-way-to-overlay-an-item-in-an-imageview

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