SurfaceView transparent through to its parent?

Showing 1-3 of 3 messages
SurfaceView transparent through to its parent? Blake B. 2/11/09 6:46 PM
I have a SurfaceView that is covering a portion of its parent, a
RelativeLayout.  I have a background image covering the full
RelativeLayout area, and this is my Activity's main layout.

I would like to have the SurfaceView be transparent so that I can see
through to the background image on its parent RelativeLayout.  I have
tried the approach shown in the API Demos example
TranslucentGLSurfaceViewActivity, but this succeeds in making the
transparency go all the way through my Activity to my desktop!

I'm using the "style/Theme.Translucent" theme on my activity, and
setting this on my SurfaceView:
   mySurfaceView.getHolder().setFormat(PixelFormat.RGBA_8888);

The transparency to the desktop it kinda cool, but not what I'm trying
to do!  Is it possible to make a SurfaceView transparent only through
to its parent?

Thanks,
Blake
Re: [android-developers] SurfaceView transparent through to its parent? Dianne Hackborn 2/11/09 7:09 PM
The surface view is actually BEHIND your window, and a hole punched in the window for you to see it.  You thus can put things on top of it in your window, but nothing in your window can appear behind it.--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support.  All such questions should be posted on public forums, where I and others can see and answer them.

Re: [android-developers] SurfaceView transparent through to its parent? nmelo 1/28/12 4:23 PM
There is a solution to this problem posted on SO: 


Only reproducing the answer here for future reference: 

SurfaceView sfvTrack = (SurfaceView)findViewById(R.id.sfvTrack);
sfvTrack
.setZOrderOnTop(true);    // necessary
sfhTrack
= sfvTrack.getHolder();
sfhTrack
.setFormat(PixelFormat.TRANSPARENT);