android 方面知识 包括skia opengles
Android之SurfaceView学习(一)
首先我们先来看下官方API对SurfaceView的介绍
SurfaceView的API介绍
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.
Access to the underlying surface is provided via the SurfaceHolder interface, which can be retrieved by calling getHolder().
The Surface will be created for you while the SurfaceView's window is visible; you should implement surfaceCreated(SurfaceHolder) and
surfaceDestroyed(SurfaceHolder) 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 in to the screen. If you are going to use it this way, you need to be aware of some threading semantics:
All SurfaceView and SurfaceHolder.Callback 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 SurfaceHolder.Callback.surfaceCreated() and SurfaceHolder.Callback.surfaceDestroyed().
对应的中文翻译
SurfaceView是视图(View)的继承类,这个视图里内嵌了一个专门用于绘制的Surface。你可以控制这个Surface的格式和尺寸。Surfaceview控制这个Surface的绘制位置。
surface是纵深排序(Z-ordered)的,这表明它总在自己所在窗口的后面。surfaceview提供了一个可见区域,只有在这个可见区域内 的surface部分内容才可见,可见区域外的部分不可见。surface的排版显示受到视图层级关系的影响,它的兄弟视图结点会在顶端显示。这意味者 surface的内容会被它的兄弟视图遮挡,这一特性可以用来放置遮盖物(overlays)(例如,文本和按钮等控件)。注意,如果surface上面 有透明控件,那么它的每次变化都会引起框架重新计算它和顶层控件的透明效果,这会影响性能。
你可以通过SurfaceHolder接口访问这个surface,getHolder()方法可以得到这个接口。
surfaceview变得可见时,surface被创建;surfaceview隐藏前,surface被销毁。这样能节省资源。如果你要查看 surface被创建和销毁的时机,可以重载
SurfaceView 使用了双缓冲技术,它是提供给需要直接画像素而不是使用窗体部件的...android:drawable="@drawable/a1" android:duration="500" /> <item android:...
高级程序员修炼之道-Android培训系列课程之SurfaceView2_计算机软件及应用_IT/计算机_专业资料。学软件,到拓胜浸入式Java培训!全国唯一采用软件工厂模式培训国际化软件...
高级程序员修炼之道-Android培训系列课程之SurfaceView1_计算机软件及应用_IT/计算机_专业资料。学软件,到拓胜浸入式Java培训!全国唯一采用软件工厂模式培训国际化软件...
关键词:android教程android开发android知识android学习SurfaceView 1/2 相关文档推荐...android 大扫盲之 SurfaceView,SurfaceHolder 你 hold 住了吗 最近接触到了 SurfaceV...
Android之SurfaceView使用总结_计算机软件及应用_IT/计算机_专业资料。Android 之 SurfaceView 使用总结 1.概念 SurfaceView 是 View 类的子类,可以直接从内存或者 DMA...
www.tsingyuan.cn android 大扫盲之 SurfaceView,SurfaceHolder 你 hold 住了吗 最近接触到了 SurfaceView,SurfaceHolder,SurfaceHolder.CallBack,一直不求其解, 现在...
Android学习之View类和s... 4页 1下载券喜欢此文档的还喜欢 ...高速描绘—SurfaceView 一. 简介 Android 开发电子游戏不可缺少的高速描绘 ...
android中用SurfaceHolder处理SurfaceView的画图_IT/计算机_专业资料。在用 SurfaceView...经过这一阵子对 android 的学习,我找到了自已在 android 中游戏开发的误区,不要...
Android学习笔记——播放sdcard上的视频,VideoView或SurfaceView_IT/计算机_专业资料。android学习有两种方法可以用来播放视屏,一种是用 videoview,另外一种是用 surfa...
热门文档