简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM