SurfaceHolder.Callback

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)
Since:   API Level 1

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.
当surface的任何结构(格式或大小)发生改变,这个方法就立即被调用。你应该在此刻更新surface。这个方法至少会被调用一次,在 surfaceCreated(SurfaceHolder).调用之后。

public abstract void surfaceCreated (SurfaceHolder holder)
Since:   API Level 1

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.
当surface第一次创建的时候,这个方法就会被立即调用。这个方法的实现可以完成surface创建后的一些初始化工作。

public abstract void surfaceDestroyed (SurfaceHolder holder)
Since:   API Level 1

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.
在一个surface被销毁前,这个方法会被调用。在这个调用返回后,你再也不应该去访问surface了。
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值