2012-10-03 101 views
2

我正在使用自定義攝像頭和表面視圖。但問題是相機方向不能以正確的模式顯示。攝像頭方向未以正確模式顯示android

我試着用這個代碼:

Camera.Parameters p = c.getParameters(); 
parameters.set("orientation", "portrait"); 
parameters.set("rotation", 90); 
c.setParameters(p); 

,也與此代碼:

mCamera.setDisplayOrientation(mRotation); 

But no effect. If there any other solution for this. Please tell me. 
+1

我通過代碼去了,我認爲這將有助於你[查看該] [1] [1]:http://stackoverflow.com/questions/4645960/how-to-set- android-camera-orientation-properly –

回答

2

mCamera.setDisplayOrientation(90)完全適用於我,我測試的設備上,有一個明顯的例外(這是一個相當長的鏡頭,但它可以解釋你的問題):三星Galaxy Ace,在這個功能不能按預期工作。

+0

我正在測試三星Galaxy Ace和三星Galaxy Y. –

+0

謝謝。根據你的建議,我測試了HTC one和LG,並且完全使用這個代碼。如果(getResources()。getConfiguration()。orientation == Configuration.ORIENTATION_PORTRAIT){camera.setDisplayOrientation(90); parameters.set(「orientation」,「portrait」); parameters.set(「rotation」,90);} –

+0

您是如何解決Galaxy Ace上的問題的?我現在有這個問題。 –

相關問題