相关疑难解决方法(0)

使用Android camera2进行全屏预览

我正在使用新的camera2 API构建自定义相机.我的代码是基于谷歌提供的代码示例在这里.

我无法找到一种方法来全屏显示相机.在代码示例中,他们使用比率优化来适应所有屏幕,但它只占屏幕高度的3/4左右.

这是我的代码AutoFitTextureView:

public class AutoFitTextureView extends TextureView {

private int mRatioWidth = 0;
private int mRatioHeight = 0;

public AutoFitTextureView(Context context) {
    this(context, null);
}

public AutoFitTextureView(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
}

public AutoFitTextureView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

/**
 * Sets the aspect ratio for this view. The size of the view will be measured based on the ratio
 * calculated from the parameters. Note …
Run Code Online (Sandbox Code Playgroud)

camera android camera2 android-camera2

11
推荐指数
2
解决办法
8717
查看次数

标签 统计

android ×1

android-camera2 ×1

camera ×1

camera2 ×1