Class Overview
A client may implement this interface to receive information about changes to the surface. When used with a SurfaceView
, the Surface being held is only available between calls tosurfaceCreated(SurfaceHolder)
and surfaceDestroyed(SurfaceHolder)
. The Callback is set with SurfaceHolder.addCallback
method.
类概述
一个类可能实现这个接口来接受surface改变的信息。当使用SurfaceView的时候,那么Surface仅仅在surfaceCreated(SurfaceHolder)
and surfaceDestroyed(SurfaceHolder)
之间是可以被使用的。Callback是通过SurfaceHolder.addCallback
方法添加到SurfaceHolder当中的。
public abstract void surfaceChanged (SurfaceHolder holder, int format, int width, int height)
This is called immediately after any structural changes (format or size) have been made to the surface. You should at this point update the imagery in the surface. This method is always called at least once, after surfaceCreated(SurfaceHolder)
.
Parameters
holder | The SurfaceHolder whose surface has changed. |
---|---|
format | The new PixelFormat of the surface. |
width | The new width of the surface. |
height | The new height of the surface. |
surfaceCreated(SurfaceHolder)
.调用之后。
public abstract void surfaceCreated (SurfaceHolder holder)
This is called immediately after the surface is first created. Implementations of this should start up whatever rendering code they desire. Note that only one thread can ever draw into a Surface
, so you should not draw into the Surface here if your normal rendering will be in another thread.
Parameters
holder | The SurfaceHolder whose surface is being created. |
---|
public abstract void surfaceDestroyed (SurfaceHolder holder)
This is called immediately before a surface is being destroyed. After returning from this call, you should no longer try to access this surface. If you have a rendering thread that directly accesses the surface, you must ensure that thread is no longer touching the Surface before returning from this function.
Parameters
holder | The SurfaceHolder whose surface is being destroyed. |
---|