Strange behavior when rotating a layout (e.g. a FrameLayout) with an image view inside, on different Android versions.
Take a look at the following piece of XML layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000" >
<FrameLayout
android:layout_width="250dp"
android:layout_height="250dp"
android:background="#ffffff"
android:layout_gravity="center"
android:rotation="15" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/bg" />
</FrameLayout>
</FrameLayout>
The following will display good results on Android 4.3 and 4.4, but strange result on Android 4.2, 4.1, 4.0.3.
On Android 4.2 (bad result)
on Android 4.3 (good result)
Anyone knows why this happens prior to Android 4.3 and how to fix it ?
Thanks !