我使用的摄像头,显示preVIEW只(不拍照或录制视频)。
I'm using the camera to show preview only (not to take pictures or record videos).
该应用程序始终处于纵向模式(风景模式被禁用)。 相机preVIEW总是旋转90度逆时针,我不能改变它 (既不setDisplayOrientation也不符合P.SET(方向,肖像)和P.SET(旋转,90))。
The app is always in portrait mode (landscape mode is disabled). The camera preview is always rotated 90 degrees ccw and I can't change it (neither with setDisplayOrientation nor with p.set("orientation", "portrait" ) and p.set("rotation", 90) ).
时的preVIEW始终旋转这样或者是设备相关?如果它总是像这样在纵向模式下,我可以将图像旋转之后。
Is the preview ALWAYS rotated like this or is it device dependent? If it was always like this in portrait mode, I could just rotate the image afterwards.
或者是有没有办法正确设置相机?我读了很多线程关于这一点,但没有答案为我工作(GALAXY S2,Android的V2.3)
Or is there a way to set up the camera correctly? I've read a lot of threads about this but no answer worked for me (Galaxy s2, Android v2.3)
要强制纵向:
设置安卓screenOrientation =画像
在的AndroidManifest.xml
并调用 camera.setDisplayOrientation(90);
之前调用 camera.start preVIEW();
set android:screenOrientation="portrait"
in your AndroidManifest.xml
and call camera.setDisplayOrientation(90);
before calling camera.startPreview();
我还没有在GS2测试,但它的作品每一个电话我已经测试上。
I have not tested on the GS2 but it works on every phone I have tested on.
注:setDisplayOrientation中添加了API 8级
Note: setDisplayOrientation was added in API Level 8