I am currently working on an Android App that needs several overlapping SurfaceViews in one screen.
To be precise, I have two active overlapping SurfaceViews, one connected to Camera and the other connected to MediaPlayer. It mostly works but is not stable. At times, one of the SurfaceViews does not show up.
I saw a thread from 2009(http://groups.google.com/group/android-developers/browse_thread/thread/08e7df2e96a7973d) that says overlapping SurfaceViews are not supported in Android. Is this still the case? Anyone can share experience on this?
I found it out myself. Call setZOrderOnTop(true) on the SurfaceView I want to have on top seems solve the problem
surface.setZOrderOnTop(true);
surface.setZOrderMediaOverlay(true);
If two of Surfaceview are set, there will be a problem of occlusion, if you want one of them to be at the top, then only set Setzorderontop (true), but in doing so, it will always be at the top, and any other view will be blocked, if you set Setzorderontop and set Setzordermediaoverlay, that Setzorderontop will fail
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With