See Also: SurfaceView
public class SurfaceView : View
Provides a dedicated drawing surface embedded inside of a view hierarchy. You can control the format of this surface and, if you like, its size; the SurfaceView takes care of placing the surface at the correct location on the screen
The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed. The view hierarchy will take care of correctly compositing with the Surface any siblings of the SurfaceView that would normally appear on top of it. This can be used to place overlays such as buttons on top of the Surface, though note however that it can have an impact on performance since a full alpha-blended composite will be performed each time the Surface changes.
The transparent region that makes the surface visible is based on the layout positions in the view hierarchy. If the post-layout transform properties are used to draw a sibling view on top of the SurfaceView, the view may not be properly composited with the surface.
Access to the underlying surface is provided via the SurfaceHolder interface, which can be retrieved by calling SurfaceView.Holder.
The Surface will be created for you while the SurfaceView's window is visible; you should implement ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder) and ISurfaceHolderCallback.SurfaceDestroyed(ISurfaceHolder) to discover when the Surface is created and destroyed as the window is shown and hidden.
One of the purposes of this class is to provide a surface in which a secondary thread can render into the screen. If you are going to use it this way, you need to be aware of some threading semantics:
- All SurfaceView and ISurfaceHolderCallback methods will be called from the thread running the SurfaceView's window (typically the main thread of the application). They thus need to correctly synchronize with any state that is also touched by the drawing thread.
- You must ensure that the drawing thread only touches the underlying Surface while it is valid -- between ISurfaceHolderCallback.SurfaceCreated(ISurfaceHolder) and ISurfaceHolderCallback.SurfaceDestroyed(ISurfaceHolder).
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1
The members of Android.Views.SurfaceView are listed below.
See Also: View
This is used by the RootView to perform an optimization when the view hierarchy contains one or several SurfaceView.
Control whether the surface view's content should be treated as secure, preventing it from appearing in screenshots or from being viewed on non-secure displays.
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).
Control whether the surface view's surface is placed on top of its window.