在纵向上SurfaceView Android摄像头纵向、摄像头、SurfaceView、Android

2023-09-12 11:28:21 作者:安安

我试图尽量让相机preVIEW显示在纵向上的 SurfaceView 几件事情。毫无效果。我正在测试一个Droid的有2.0.1。我想:

I tried several things to try to get the camera preview to show up in portrait on a SurfaceView. Nothing worked. I am testing on a Droid that has 2.0.1. I tried:

1)迫使布局是画像: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

1) forcing the layout to be portrait by: this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

2)使用

Camera.Parameters parameters = camera.getParameters();
parameters.set("orientation", "portrait");
parameters.setRotation(90);
camera.setParameters(parameters);

有没有别的东西,我可以尝试一下呢?如果在Android或手机中的错误我怎么能保证是这样的话,使我有证据通知客户?

Is there something else I can try? If this a bug in Android or the phone how can I make sure that this is the case so that I have proof to inform the client?

谢谢, 人员Prasanna

Thanks, Prasanna

推荐答案

随着API的LVL 8,这是可用的:

As of API lvl 8, this is available:

公众最终无效setDisplayOrientation(INT度)

public final void setDisplayOrientation (int degrees)

即。与波泰特在清单:

public void surfaceCreated(SurfaceHolder holder) {
    mCamera = Camera.open();
    mCamera.setDisplayOrientation(90);