问题描述
我需要使用它了android SurfaceView
,或样品code可以共享一个样本教程。该API演示是我很难理解。有没有人有办法吗?
I need a sample tutorial for the android SurfaceView
, or sample code using it that can be shared. The API demos are difficult for me to understand. Does anyone have alternatives?
推荐答案
This提交我的显示你有必要的修改,以从的来的android.view.SurfaceView与android.view.SurfaceHolder.Callback.
This commit of my WorldMap demo app shows you the changes necessary to convert from an android.view.View to an android.view.SurfaceView with an android.view.SurfaceHolder.Callback.
它通过使用查看欺骗一点的
的onDraw()
从 SurfaceView DrawThread ,并通过调用查看
的 > onSizeChanged()
从内部 SurfaceView
的 surfaceChanged
。它只是使差异较小,更容易理解。
It cheats a bit by using the View
's onDraw()
from within the SurfaceView
's DrawThread
and by calling the View
's onSizeChanged()
from within the SurfaceView
's surfaceChanged
. It just makes the diff smaller and easier to understand.
这篇关于SurfaceView样本code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!