【发布时间】:2014-09-03 06:34:11
【问题描述】:
我通过设置纹理矩阵将相机预览设为平方,如下所示:
但是当点击actionbar的overflow按钮或者底部的按钮时,会显示相机预览的隐藏部分,像这样:
我对此一无所知,谁能帮帮我???
【问题讨论】:
标签: android camera textureview
我通过设置纹理矩阵将相机预览设为平方,如下所示:
但是当点击actionbar的overflow按钮或者底部的按钮时,会显示相机预览的隐藏部分,像这样:
我对此一无所知,谁能帮帮我???
【问题讨论】:
标签: android camera textureview
这是有时会发生的事情,我真的不知道为什么,但你可以很容易地阻止它。 在你的布局中,如果你有类似的东西:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black" >
<TextureView
android:id="@+id/textureView"
android:layout_width="YOUR_WIDTH"
android:layout_height="YOUR_HEIGHT" >
</TextureView>
<!-- other stuff -->
</LinearLayout>
只需使用框架布局或任何其他具有相同尺寸的布局包装纹理视图,如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black" >
<FrameLayout
android:layout_width="YOUR_WIDTH"
android:layout_height="YOUR_HEIGHT"
android:background="@color/black" >
<TextureView
android:id="@+id/textureView"
android:layout_width="YOUR_WIDTH"
android:layout_height="YOUR_HEIGHT" >
</TextureView>
</FrameLayout>
<!-- other stuff -->
</LinearLayout>
如果您在运行时更改TextureView的尺寸,请记住还要将包装器FrameLayout的尺寸更改为完全相同
【讨论】: