ImplementationMode
class ImplementationMode
kotlin.Any | ||
↳ | kotlin.Enum<androidx.camera.view.PreviewView.ImplementationMode> | |
↳ | androidx.camera.view.PreviewView.ImplementationMode |
The implementation mode of a PreviewView
.
User preference on how the PreviewView
should render the preview. PreviewView
displays the preview with either a SurfaceView
or a TextureView
. A SurfaceView
is generally better than a TextureView
when it comes to certain key metrics, including power and latency. On the other hand, TextureView
is better supported by a wider range of devices. The option is used by PreviewView
to decide what is the best internal implementation given the device capabilities and user configurations.
Summary
Enum values | |
---|---|
Use a |
|
Use a |
Enum values
PERFORMANCE
enum val PERFORMANCE : PreviewView.ImplementationMode
Use a SurfaceView
for the preview when possible. If the device doesn't support SurfaceView
, PreviewView
will fall back to use a TextureView
instead.
PreviewView
falls back to TextureView
when the API level is 24 or lower, the camera hardware support level is CameraCharacteristics#INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY
, or Preview#getTargetRotation()
is different from PreviewView
's display rotation.
Do not use this mode if Preview.Builder#setTargetRotation(int)
is set to a value different than the display's rotation, because SurfaceView
does not support arbitrary rotations. Do not use this mode if the PreviewView
needs to be animated. SurfaceView
animation is not supported on API level 24 or lower. Also, for the preview's streaming state provided in getPreviewStreamState
, the StreamState#STREAMING
state might happen prematurely if this mode is used.