i had made camera preview to squared by setting Texture Matrix, like this:
but when click the overflow button of actionbar or the button in bottom, the hidden part of camera preview will be shown, like this:
I have no idea about this, could someone help me???
That is something that sometimes happens, I dont really know why, but you can easily prevent it. In you layout, if you have something like:
<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>
Just wrap the texture view with a framelayout, or any other layout, with the same dimensions, something like this:
<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>
If you change the dimensions of the TextureView
in runtime, remember also to change the dimensions of the wrapper FrameLayout
to exactly the same
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.