2011-02-25 228 views
3

我跟着this的例子。但是,當我將它連接到手機時(爲了使用相機),預覽會向左翻轉90度。除此之外,它工作正常。安卓相機翻轉

我的問題是:我該如何「解開」預覽

這是我的佈局文件的內容:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="horizontal"> 
     <android.view.SurfaceView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/preview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 
    </android.view.SurfaceView> 
</LinearLayout> 

此外,當我試圖把自己它停留在「風景」模式的手機。

在此先感謝!

+0

你的意思是在肖像或風景結束了? – 2011-02-25 14:55:09

+0

當你說'翻轉'你的意思是'旋轉'?如果是這樣,也許它看起來太明顯了,但你的方向確實有水平。或者,也許我誤解了這個問題! – Kevin 2011-02-25 14:56:15

+0

是的,它結束了景觀。無論方向是「水平」還是「垂直」,都沒有關係,仍然是相同的結果。 – whirlwin 2011-02-25 15:01:10

回答

1

我以前有同樣的問題。我只是增加了一個參數來旋轉視圖90.這個參數添加到表面更改的功能:當你說「翻轉90度向左」

parameters.setRotation(90);