Camera preview is letterboxed when on portrait

有些话、适合烂在心里 提交于 2019-12-11 17:33:02

问题


I'm using the cameraPreview sample coming with the Android API demos. 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.

A couple of pics (sorry for poor the quality): portrait http://i42.tinypic.com/a9qzuu.jpg

Is this normal behavior of the demo program? What's a proper way to fix it?


回答1:


This helped for me :

mCamera.setDisplayOrientation(90);




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/9398089/camera-preview-is-letterboxed-when-on-portrait

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!