Search code examples
androidcameraimageviewsurfaceviewsurfaceholder

Stack ImageView on top of surface where camera preview is running?


I'm trying to display an image on top of a surface where a camera preview is running. So far I have the camera running using a SurfaceHolder. I thought maybe I could use a FrameLayout to stack an image on top of the camera preview, but I don't know how to go about it. How can I do this, or is there any other way to do it?

I prefer to code programatically, but any help is appreciated!

Thank You


Solution

  • Instead of using a FrameLayout, you could use a RelativeLayout, which uses z-ordering. Simply put your ImageView after your SurfaceHolder inside the RelativeLayout and it will appear overtop of it.