- Common ways to obtain SurfaceView
private void myMethod () {SurfaceView s =
Context context;new SurfaceView(context)
View view;(SurfaceView) view.findViewById(id)
ViewStub viewStub;(SurfaceView) viewStub.inflate()
- Smart code suggestions by Codota
}
private void initView() { surfaceHolder = svRecord.getHolder(); surfaceHolder.addCallback(this); //设置一些参数方便后面绘图 svRecord.setFocusable(true); svRecord.setKeepScreenOn(true); svRecord.setFocusableInTouchMode(true); pbRecord.setMax(100); pbRecord.setProgress(0); }
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); surfaceHolder.setKeepScreenOn(true); surfaceView.setFocusable(true); surfaceView.setBackgroundColor(TRIM_MEMORY_BACKGROUND); surfaceView.getHolder().addCallback(new SurfaceCallback());//为SurfaceView的句柄添加一个回调函数
private void initView() { surfaceHolder = svRecord.getHolder(); surfaceHolder.addCallback(this); //设置一些参数方便后面绘图 svRecord.setFocusable(true); svRecord.setKeepScreenOn(true); svRecord.setFocusableInTouchMode(true); pbRecord.setMax(100); pbRecord.setProgress(0); }
surfaceHolder.addCallback(this); cameraView.setFocusable(true); cameraView.setFocusableInTouchMode(true); cameraView.setClickable(true);
surfaceHolder.addCallback(this); cameraView.setFocusable(true); cameraView.setFocusableInTouchMode(true); cameraView.setClickable(true);