Handling two surfaceViews

空扰寡人 提交于 2019-11-30 18:56:52

问题


I have two surface Views 1> MediaRecorder display surfaceview. 2> MediaPlayer SurfaceView displaying the Media recorded by MediaRecorder.

I want to display both the views simultaneously on the screen z ordered.

The mediaPlayer will be palying in full screen and the MediaRecorderPreview shd appear in the top right corner with some smaller size.

I am able to do this using two surfaces but the issue is that the MediaRecorder Preview always goes to the background z order and gets hidden by the mediaplayer full screen display.

Is their any way to define the Z order of Surface View.

Or is their any other suzzestion i can do to make this work. Can i start both MediaRecorder and MediaPlayer in a single surface?

Pls suggest. Thanks!!


回答1:


I want to display both the views simultaneously on the screen z ordered.

AFAIK, that is not supported by Android. Android cannot composite multiple SurfaceViews. It can handle a regular View (e.g., Button) on top of a SurfaceView, but not two SurfaceViews Z ordered.

I recommend redesigning your application to have a single SurfaceView at a time.




回答2:


As of Android 2 (API level 5) having 2 surfaceviews is supported. You can set the zOrder of the 2 surface views using setZOrderMediaOverlay although apparently it breaks the intended semantics of SurfaceView.



来源:https://stackoverflow.com/questions/4521674/handling-two-surfaceviews

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!