在這裏,我們遇到同樣的問題,我用你上面的代碼,看看它是如何工作的,以及它看起來像旋轉中心位移,從而旋轉90度時的畫像它只是顯示視圖的約10-20% 。
現在看來似乎是:
mCamera.setDisplayOrientation(90);
這會導致問題。
這是可再現上:
- 索尼XPERIA ST25i,採用Android 4.0.4版本(版本:6.1.1.B.1.54)
- 索尼XPERIA獨奏MT27i,採用Android 4.0.4(建設:6.1.1.B.1.54)
這裏是相機參數,如果它們包含的任何信息:
01-22 16:04:01.015: D/CameraTest(1336): Haz camera: true
01-22 16:04:01.095: D/TextLayoutCache(1336): Using debug level: 0 - Debug Enabled: 0
01-22 16:04:01.425: D/libEGL(1336): loaded /system/lib/egl/libGLES_android.so
01-22 16:04:01.505: D/libEGL(1336): loaded /system/lib/egl/libEGL_mali.so
01-22 16:04:01.535: D/libEGL(1336): loaded /system/lib/egl/libGLESv1_CM_mali.so
01-22 16:04:01.545: D/libEGL(1336): loaded /system/lib/egl/libGLESv2_mali.so
01-22 16:04:01.725: D/OpenGLRenderer(1336): Enabling debug mode 0
01-22 16:04:02.987: D/CameraTest(1336): preferred-preview-size-for-video=864x480
01-22 16:04:02.987: D/CameraTest(1336): zoom=0
01-22 16:04:02.987: D/CameraTest(1336): recording-hint=false
01-22 16:04:02.987: D/CameraTest(1336): max-num-detected-faces-hw=5
01-22 16:04:02.987: D/CameraTest(1336): zoom-supported=true
01-22 16:04:02.987: D/CameraTest(1336): whitebalance=auto
01-22 16:04:02.987: D/CameraTest(1336): scene-mode=auto
01-22 16:04:02.987: D/CameraTest(1336): jpeg-quality=85
01-22 16:04:02.987: D/CameraTest(1336): preview-format-values=yuv420sp,yuv420p
01-22 16:04:02.987: D/CameraTest(1336): jpeg-thumbnail-quality=100
01-22 16:04:02.987: D/CameraTest(1336): preview-format=yuv420sp
01-22 16:04:02.987: D/CameraTest(1336): video-size-values=1280x720,864x480,720x480,640x480,352x288,320x240,176x144
01-22 16:04:02.987: D/CameraTest(1336): preview-size=640x480
01-22 16:04:02.987: D/CameraTest(1336): focal-length=3.5
01-22 16:04:02.987: D/CameraTest(1336): flash-mode-values=off,auto,on,red-eye,torch
01-22 16:04:02.987: D/CameraTest(1336): preview-frame-rate-values=15,30
01-22 16:04:02.987: D/CameraTest(1336): max-num-metering-areas=0
01-22 16:04:02.987: D/CameraTest(1336): preview-frame-rate=30
01-22 16:04:02.987: D/CameraTest(1336): focus-mode-values=auto,infinity,macro,fixed,continuous-picture,continuous-video
01-22 16:04:02.987: D/CameraTest(1336): jpeg-thumbnail-width=160
01-22 16:04:02.987: D/CameraTest(1336): video-size=1280x720
01-22 16:04:02.987: D/CameraTest(1336): scene-mode-values=auto,portrait,landscape,night,night-portrait,beach,snow,sports,party,barcode
01-22 16:04:02.987: D/CameraTest(1336): preview-fps-range-values=(1000,15000),(1000,30000)
01-22 16:04:02.987: D/CameraTest(1336): jpeg-thumbnail-size-values=160x120,0x0
01-22 16:04:02.987: D/CameraTest(1336): zoom-ratios=100,107,115,123,132,141,152,162,174,187,200,214,230,246,264,283,303,325,348,373,400,429,459,492,528,566,606,650,696,746,800
01-22 16:04:02.987: D/CameraTest(1336): preview-size-values=864x480,720x480,640x480,480x320,352x288,320x240,176x144
01-22 16:04:02.987: D/CameraTest(1336): picture-size-values=2592x1944,2560x1440,1632x1224,1920x1080,640x480,480x320,320x240
01-22 16:04:02.987: D/CameraTest(1336): preview-fps-range=1000,30000
01-22 16:04:02.987: D/CameraTest(1336): auto-whitebalance-lock=false
01-22 16:04:02.987: D/CameraTest(1336): min-exposure-compensation=-6
01-22 16:04:02.987: D/CameraTest(1336): antibanding=auto
01-22 16:04:02.987: D/CameraTest(1336): max-num-focus-areas=1
01-22 16:04:02.987: D/CameraTest(1336): vertical-view-angle=360
01-22 16:04:02.987: D/CameraTest(1336): horizontal-view-angle=360
01-22 16:04:02.987: D/CameraTest(1336): video-stabilization-supported=false
01-22 16:04:02.987: D/CameraTest(1336): jpeg-thumbnail-height=120
01-22 16:04:02.987: D/CameraTest(1336): smooth-zoom-supported=true
01-22 16:04:02.987: D/CameraTest(1336): focus-mode=macro
01-22 16:04:02.987: D/CameraTest(1336): auto-whitebalance-lock-supported=true
01-22 16:04:02.987: D/CameraTest(1336): video-frame-format=yuv420mb
01-22 16:04:02.987: D/CameraTest(1336): max-num-detected-faces-sw=5
01-22 16:04:02.987: D/CameraTest(1336): picture-format-values=jpeg
01-22 16:04:02.987: D/CameraTest(1336): max-exposure-compensation=6
01-22 16:04:02.987: D/CameraTest(1336): focus-areas=(0,0,0,0,0)
01-22 16:04:02.987: D/CameraTest(1336): video-snapshot-supported=false
01-22 16:04:02.987: D/CameraTest(1336): exposure-compensation=0
01-22 16:04:02.987: D/CameraTest(1336): exposure-compensation-step=0.333333
01-22 16:04:02.987: D/CameraTest(1336): flash-mode=off
01-22 16:04:02.987: D/CameraTest(1336): auto-exposure-lock=false
01-22 16:04:02.987: D/CameraTest(1336): effect-values=none,mono,negative,solarize,sepia,posterize
01-22 16:04:02.987: D/CameraTest(1336): picture-size=2592x1944
01-22 16:04:02.987: D/CameraTest(1336): max-zoom=30
01-22 16:04:02.987: D/CameraTest(1336): effect=none
01-22 16:04:02.987: D/CameraTest(1336): whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight
01-22 16:04:02.987: D/CameraTest(1336): picture-format=jpeg
01-22 16:04:02.987: D/CameraTest(1336): focus-distances=Infinity,Infinity,Infinity
01-22 16:04:02.987: D/CameraTest(1336): auto-exposure-lock-supported=true
01-22 16:04:02.987: D/CameraTest(1336): antibanding-values=auto,50hz,60hz,off
01-22 16:04:03.037: D/CameraTest(1336): Rotation : 0
01-22 16:04:03.037: D/CameraTest(1336): Preview Width : 480
01-22 16:04:03.037: D/CameraTest(1336): Preview Height : 744
01-22 16:04:03.057: D/CameraTest(1336): Supported FPS : [[1000, 15000], [1000, 30000]]
我對這個解決方案可以在[http://stackoverflow.com/questions/13428797找到/camera-camera-preview-is-not-proper-after-setdisplayorientation-in-android](http://stackoverflow.com/questions/13428797/camera-camera-preview-is-not-proper-after-setdisplayorientation-在-機器人)。 –