-
Surfaceview obscures the project background of other controls:
has been working on the player project recently, because the underlying implementation is switching rendering with surface and OpenGL, So both Glsurfaceview and Surfaceview are used in the layout, while the play control buttons are customized and do not use the Mediactroller controls provided by Android itself. In this context, the problem arises, if the students with the relevant development base should know, when Surfaceview and Glsurfaceview in a layout, If you want Surfaveview to display a picture or video, you must call Surfaceview.setzorderontop (true), that is, you must place the Surfaceview at the top level of the Activity Display window to display properly. Surfaceview.setzorderontop (True) is then called, causing other controls such as play, Fast forward, and so on to be obscured. There are a lot of solutions on the web, such as the solution of Surfaceview setting transparency to cover other components of the alternative, for the video playback of the page is not perfect, because it is directly on the Surfaceview to draw the relevant controls, Imagine if some of the surfaceview in some areas of the drawing of some buttons, is bound to block a portion of the video screen, which is difficult for users to accept.
-
Find a solution from Surfaceview Source:
Because the solution found on the Internet can not meet the requirements, there is no way to get back to view the next Surfaceview source code, When viewing the source code to see this method Setzordermediaoverlay (Boolean ismediaoverlay), let's look at the source code in the description of this method:
Control whether the surface View ' s surface is placed on top of another regular surface view in the window (but still behind the window itself). This was typically used to place overlays on top of an underlying media surface view.
Note that this must be set before the Surface view's containing window is attached to the window manager.
Calling this overrides any previous call to {@link #setZOrderOnTop}.
This means that the view layer of the surface in the control window is placed at the top of the regular view layer.
Finally, I call Setzorderontop (true) after calling Setzordermediaoverlay (true), OK, occlusion problem perfectly solved!
This article is from the "Xicheng Day" blog, please make sure to keep this source http://marller.blog.51cto.com/8699646/1762028
Fix Surfaceview Call Setzorderontop (true) to mask other control issues