问题
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