I would like to see an image on top of Camera SurfaceView\preview.
How do I do that? Any examples?
I would like to see an image on top of Camera SurfaceView\preview. How do
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A great example can be found in ZXing library, Barcode Scanner application.
What they do is they use
FrameLayoutforSurfaceViewand their customViewfinderViewso that bothSurfaceViewandViewfinderVieware covering full screen:Note the
fill_parentvalues inlayout_heightandlayout_widthfor both views.And then they draw custom things in
ViewfinderView.onDraw()method, just on top of what is being displayed by camera preview.If you don’t want to draw anything, but just use predefined image, then use
ImageViewinstead ofViewfinderView. You might consider callingsetAlphamethod to make your image transparent (if drawable wasn’t already transparent by itself).Here is a screenshot from Barcode Scanner: