Reputation: 1924
Hello guys,
My problem is how can I fill the outer portion of the frame. I need to show the camera moments inside the frame only. The rest of the portion will filled up with the color what we choose to fill.
Here this is the whole background captured from the camera but I don't want this.
Please suggest me what I should do?
Your true guidance and support will be additional and your efforts will highly be appreciated once you're sure to done with this.
Upvotes: 0
Views: 247
Reputation: 52313
You have two options if you don't want the camera preview to fill the entire area covered by the SurfaceView:
Option #1 is pretty straightforward. The SurfaceView surface is composited below the View UI layer, so anything you draw in a View will appear on top (e.g. the blue circle in the image you included). Just draw opaque pixels everywhere you don't want the camera preview to appear. You should be able to use the SurfaceView's View by specifying a custom onDraw()
.
Option #2 is more involved, but does give you more flexibility in how you display the camera image. The "texture from camera" activity in Grafika demonstrates this.
Upvotes: 1