开发者

Support for multiple active overlapping surface views in Android

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 开发者_如何学JAVAfrom 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


I had written an application once, with overlapping Linear Layouts. It worked fine when I overlapped them with view.layout(l,t,r,b). I am not sure if that also works with SurfaceViews. How do you overlap them?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜