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

298
July 02, 2019, at 02:40 AM

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.

Answer 1

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"

Rent Charter Buses Company
READ ALSO
TestNG intelli-sense not working in Eclipse neon

TestNG intelli-sense not working in Eclipse neon

Here is the software, library i am using:

223
redirect ws-security warning to log4j in java 5

redirect ws-security warning to log4j in java 5

I have some client-side code built from wsdl via jax-ws way with command

185
How to enable mutual Authentication only if this is the option user chooses to authenticate the system?

How to enable mutual Authentication only if this is the option user chooses to authenticate the system?

We provide different type of authentication mechanisms for our users to authenticate our appOne of them is using smart cards certificates installed on it

122
Comparing NodeJS and Java

Comparing NodeJS and Java

So here is my node js http servers in A SINGLE program file, It's important that I am not running below 2 servers in 2 separate processesThey are running in same process

131