问题
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