简体   繁体   中英

How to make SurfaceView's background transparent without using function setZOrderOnTop(true)?

I'm programming a turntable game view by LuckyPan from github . As you see, it extends a SurfaceView .

And here is my problem:

  1. I need a background below turntable with picture, it means I need a SurfaceView which has a transparent background;
  2. setZOrderOnTop(true) — I found it to make a transparent background, but it made SurfaceView above everything in the APP;
  3. Now when I run app in a short phone, the turntable will above the "bottom tab" which is at the bottom of the screen.

So, does anyone has a way can do one of these: Make SurfaceView have a transparent background without using setZOrderOnTop(true) .

OR

Set a view above the SurfaceView which have already calling setZOrderOnTop(true) .

Is this a bug of the SurfaceView that always has a not transparent background unless using the setZOrderOnTop(true) ? If it is, why google hasn't fix it for more than ten years? Or is there something I missed? Thanks for helping.

Make SurfaceView have a transparent background without using setZOrderOnTop(true)

surface.setBackgroundColor(resources.getColor(R.color.transparent))

Forgot: transparent this is a color value in a colors.xml which holds a value "#0000000"

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