Mitchell Romanuik
Mitchell Romanuik

Reputation: 193

Transparent SurfaceView over a transparent Activity

I have an Activity that is roughly 30-40% transparent which contains a custom View that extends SurfaceView. Everything is working as it should however the SurfaceView's background is not completely transparent (at least for the first few seconds). After 1-2 seconds (using debugger) I noticed the SurfaceView becomes completely transparent after onDraw is called from my Thread for the Canvas.

Now I'm assuming that the issue is; the canvas is selecting my activity's transparent background, creating a bitmap of it and then displaying it hence creating a double transparent overlay.

I've tried to initialize the SurfaceView first while the View is 'invisible' and enabled it after the first onDraw. No dice.

Any Suggestions or Questions?

Upvotes: 0

Views: 573

Answers (1)

Mitchell Romanuik
Mitchell Romanuik

Reputation: 193

My SurfaceView was Embedded within a RelativeLayout View Container. By applying the alpha parameter for this view to 255 resulted in what I was looking for.

I hope someone comes across the same situation, and that this has solved their problem.

Upvotes: 1

Related Questions