简体   繁体   English

肖像拍摄时,相机预览会带有字母框

[英]Camera preview is letterboxed when on portrait

I'm using the cameraPreview sample coming with the Android API demos. 我正在使用Android API演示随附的cameraPreview示例。 The problem is, the camera preview is showing properly on landscape, but when I rotate the phone to portrait, I get a letterboxed and rotated image. 问题是,相机预览可以在横向上正常显示,但是当我将手机旋转到纵向时,会看到带有信箱的旋转图像。

I'm using Android 2.3.3 and a Samsung Galaxy Ace, but also tried 2.1 on a Xperia Mini 10 Pro. 我正在使用Android 2.3.3和三星Galaxy Ace,但也在Xperia Mini 10 Pro上尝试了2.1。

A couple of pics (sorry for poor the quality): 几张照片(对不起,质量太差): 景观 portrait http://i42.tinypic.com/a9qzuu.jpg 肖像http://i42.tinypic.com/a9qzuu.jpg

Is this normal behavior of the demo program? 这是演示程序的正常行为吗? What's a proper way to fix it? 什么是正确的解决方法?

This helped for me : 这对我有帮助:

mCamera.setDisplayOrientation(90); mCamera.setDisplayOrientation(90);

I was able to fix the problem I was having that was very similar to this. 我能够解决我遇到的与此非常相似的问题。 It had to do with with an old supports-screens ... / entry I had in my manifest file. 它与清单文件中的旧支持屏幕... /条目有关。 I removed this from my manifest and everything worked like a charm. 我从清单中删除了它,一切都像个魅力。 Hopefully this might help solve your problem. 希望这可以帮助您解决问题。 Cheers. 干杯。

Solved it, turns out it was a problem with my manifest, I had to include a line defining a fixed screen orientation for the camera activity. 解决后,事实证明我的清单有问题,我必须添加一行以定义相机活动的固定屏幕方向。 :P :P

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM