本文整理了Java中android.view.SurfaceView.getHolder()
方法的一些代码示例,展示了SurfaceView.getHolder()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SurfaceView.getHolder()
方法的具体详情如下:
包路径:android.view.SurfaceView
类名称:SurfaceView
方法名:getHolder
暂无
代码示例来源:origin: vondear/RxTool
@Override
SurfaceHolder getSurfaceHolder() {
return mSurfaceView.getHolder();
}
代码示例来源:origin: google/cameraview
@Override
SurfaceHolder getSurfaceHolder() {
return mSurfaceView.getHolder();
}
代码示例来源:origin: google/ExoPlayer
@Override
public void setVideoSurfaceView(SurfaceView surfaceView) {
setVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
}
代码示例来源:origin: google/ExoPlayer
@Override
public void clearVideoSurfaceView(SurfaceView surfaceView) {
clearVideoSurfaceHolder(surfaceView == null ? null : surfaceView.getHolder());
}
代码示例来源:origin: stackoverflow.com
SurfaceView preview = (SurfaceView) findViewById(R.id.PREVIEW);
SurfaceHolder mHolder = preview.getHolder();
mHolder.addCallback(this);
Camera mCamera = Camera.open();
mCamera.setPreviewDisplay(mHolder);
// Turn on LED
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
mCamera.setParameters(params);
mCamera.startPreview();
...
// Turn off LED
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_OFF);
mCamera.setParameters(params);
mCamera.stopPreview();
mCamera.release();
代码示例来源:origin: stackoverflow.com
SurfaceView view = new SurfaceView(this);
c.setPreviewDisplay(view.getHolder());
c.startPreview();
c.takePicture(shutterCallback, rawPictureCallback, jpegPictureCallback);
代码示例来源:origin: stackoverflow.com
SurfaceView sfvTrack = (SurfaceView)findViewById(R.id.sfvTrack);
sfvTrack.setZOrderOnTop(true); // necessary
SurfaceHolder sfhTrackHolder = sfvTrack.getHolder();
sfhTrackHolder.setFormat(PixelFormat.TRANSPARENT);
代码示例来源:origin: HotBitmapGG/bilibili-android-client
private void initVideo() {
holder = videoView.getHolder();
ijkMediaPlayer = new IjkMediaPlayer();
getLiveUrl();
}
代码示例来源:origin: google/ExoPlayer
private void maybeStartHostedTest() {
if (hostedTest == null || hostedTestStarted) {
return;
}
Surface surface = surfaceView.getHolder().getSurface();
if (surface != null && surface.isValid()) {
hostedTestStarted = true;
Log.d(TAG, "Starting test.");
hostedTest.onStart(this, surface);
hostedTestStartedCondition.open();
}
}
代码示例来源:origin: google/ExoPlayer
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(getResources().getIdentifier("host_activity", "layout", getPackageName()));
surfaceView = findViewById(
getResources().getIdentifier("surface_view", "id", getPackageName()));
surfaceView.getHolder().addCallback(this);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(new SurfaceCallback());
addView(mSurfaceView);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(new SurfaceCallback());
addView(mSurfaceView);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
startRequested = false;
surfaceAvailable = false;
surfaceView = new SurfaceView(context);
surfaceView.getHolder().addCallback(new SurfaceCallback());
addView(surfaceView);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(new SurfaceCallback());
addView(mSurfaceView);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(new SurfaceCallback());
addView(mSurfaceView);
}
代码示例来源:origin: googlesamples/android-vision
public CameraSourcePreview(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
mStartRequested = false;
mSurfaceAvailable = false;
mSurfaceView = new SurfaceView(context);
mSurfaceView.getHolder().addCallback(new SurfaceCallback());
addView(mSurfaceView);
}
代码示例来源:origin: google/ExoPlayer
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(getResources().getIdentifier("host_activity", "layout", getPackageName()));
surfaceView = findViewById(
getResources().getIdentifier("surface_view", "id", getPackageName()));
surfaceView.getHolder().addCallback(this);
}
代码示例来源:origin: google/ExoPlayer
private void maybeStartHostedTest() {
if (hostedTest == null || hostedTestStarted) {
return;
}
Surface surface = surfaceView.getHolder().getSurface();
if (surface != null && surface.isValid()) {
hostedTestStarted = true;
Log.d(TAG, "Starting test.");
hostedTest.onStart(this, surface);
hostedTestStartedCondition.open();
}
}
代码示例来源:origin: journeyapps/zxing-android-embedded
private void setupSurfaceView() {
if(useTextureView) {
textureView = new TextureView(getContext());
textureView.setSurfaceTextureListener(surfaceTextureListener());
addView(textureView);
} else {
surfaceView = new SurfaceView(getContext());
surfaceView.getHolder().addCallback(surfaceCallback);
addView(surfaceView);
}
}
代码示例来源:origin: journeyapps/zxing-android-embedded
private void startPreviewIfReady() {
if (currentSurfaceSize != null && previewSize != null && surfaceRect != null) {
if (surfaceView != null && currentSurfaceSize.equals(new Size(surfaceRect.width(), surfaceRect.height()))) {
startCameraPreview(new CameraSurface(surfaceView.getHolder()));
} else if(textureView != null && textureView.getSurfaceTexture() != null) {
if(previewSize != null) {
Matrix transform = calculateTextureTransform(new Size(textureView.getWidth(), textureView.getHeight()), previewSize);
textureView.setTransform(transform);
}
startCameraPreview(new CameraSurface(textureView.getSurfaceTexture()));
} else {
// Surface is not the correct size yet
}
}
}
内容来源于网络,如有侵权,请联系作者删除!