SurfaceView

Class of android.view · SurfaceView.java · Android's reference

public class SurfaceView extends View

SurfaceView ← View

A view whose surface an app draws into itself, with its own GPU API (the Abstract of SurfaceFlinger's layers in docs/platforms/android-apps/interfaces.md): its surface is the host window, at the view's size. The surface exists while the view is attached and laid out, as Android's callbacks give it. The view draws the hole Android punches: transparent.

Extended in the framework by

Constructors

public SurfaceView(Context context) source
public SurfaceView(Context context, AttributeSet attrs) source
public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr) source
public SurfaceView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) source

Methods

public SurfaceHolder getHolder() source
public void setZOrderOnTop(boolean onTop) empty body source
public void setZOrderMediaOverlay(boolean isMediaOverlay) empty body source
public void setSecure(boolean isSecure) empty body source
public Surface getSurfaceControl() source
protected void onAttachedToWindow() source
protected void onDetachedFromWindow() source
protected void onSizeChanged(int w, int h, int oldw, int oldh) source
protected void onWindowVisibilityChanged(int visibility) source
public void draw(Canvas canvas) source

The hole in the window that the surface shows through, as Android's SurfaceView punches it: the view's area cleared to transparent, over the window's background. The renderer's frames are blended over the app's own presents (docs/platforms/android-apps/hwui.md), so the app's frame shows there, and the window's other views and dialogs over it.

protected void onDraw(Canvas canvas) empty body source

Made from ScarletNX's Sail at 166ad3910f80. The framework is ScarletNX's (GPL-3.0-or-later); the parts that follow the Android Open Source Project's sources (Apache-2.0) say so in their files.