简体   繁体   中英

Camera preview is letterboxed when on portrait

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?

This helped for me :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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