闪光灯
val imageCaptureConfig = ImageCaptureConfig.Builder().apply {//在config里面设置
setLensFacing(lensFacing)
setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY)
setFlashMode(flashMode)
setTargetRotation(texture_view.display.rotation)
}.build()
FlashMode.AUTO/FlashMode.OFF/FlashMode.ON
有这三种模式。
打开系统相册
在点击事件中
val intent = Intent()
intent.type = "image/*"
intent.action = Intent.ACTION_GET_CONTENT
startActivityForResult(intent, REQUEST_CODE_SELECT_PHOTO)
并重写在点击事件所在的Activity的onActivityResult
if (resultCode == Activity.RESULT_OK) {
if (requestCode == REQUEST_CODE_SELECT_PHOTO) {
//todo
}
}