I am using Camerax API for image capturing. PreviewView Android 10 is extending outside the bounds, see the below screenshot before and after image capture.
how to use both scale type or any other options are available.
val cameraProvider: ProcessCameraProvider = cameraProviderFuture.get()
val preview = Preview.Builder()
//.setTargetResolution(Size(frame_rect!!.width, frame_rect!!.height))
.build()
.also {
it.setSurfaceProvider(viewFinder!!.surfaceProvider)
}
imageCapture = ImageCapture.Builder().build()
val imageAnalysis = ImageAnalysis.Builder()
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
.build()
imageAnalysis.setAnalyzer(cameraExecutor, ImageAnalysis.Analyzer { image ->
Log.d("IVYCAMERA", "Captured Image...!!!")
// insert your code here.
})
val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
try {
// Unbind use cases before rebinding
cameraProvider.unbindAll()
camera = cameraProvider.bindToLifecycle(
this, cameraSelector, imageAnalysis, preview, imageCapture
)
} catch (exc: Exception) {
Log.e(TAG, "Use case binding failed", exc)
}
}, Co