2011-02-25 151 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);