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