【问题标题】:How to use cameraX with SurfaceView/TextureView?如何将 cameraX 与 SurfaceView/TextureView 一起使用?
【发布时间】:2021-10-21 04:23:02
【问题描述】:

我计划将相机 api 迁移到 camerax。目前我正在使用 SurfaceView 来显示相机预览。我注意到 camerax 正在使用 PreviewView 来显示相机预览。由于这个库仍处于 alpha 阶段,那么替代方案是什么?

我知道 previewView 在内部使用 SurfaceView/TextureView。

如何显式配置和使用 SurfaceView/TextureView?

【问题讨论】:

    标签: android surfaceview android-jetpack android-camerax android-textureview


    【解决方案1】:

    您最好的选择是使用 PreviewView。正确管理 Surface 需要解决许多极端情况。如果您坚持自己编写代码,请查看 PreviewView 的实现并从那里开始。

    请参阅:SurfaceView implementation 和 TextureView implementation

    【讨论】:

    • 是的。最好使用 PreviewView。
    猜你喜欢
    • 2020-06-03
    • 2014-02-13
    • 2015-01-29
    • 1970-01-01
    • 2011-10-18
    • 2018-09-03
    • 1970-01-01
    • 1970-01-01
    • 2015-02-07
    相关资源
    最近更新 更多