I have a simple layout and bumped into difference between Jelly Bean and Froyo. On Jelly Bean I have ImageView
matched its parent (FrameLayout
) by height. But on Froyo it is not. Please have a look on layout structure:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:id="@+id/fl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/profile_data_background_im"
android:scaleType="fitXY"/>
<LinearLayout
android:id="@+id/ll"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test text"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test text"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
So what I have on Jelly Bean (and it is as expected):
Here is what I have on Froyo:
Please advice how to have the ImageView
to fill its parent as it is for Jelly Bean. Thank you very much.
I came across this same phenomenon only recently. After looking at the Android source and subclassing View such as to see what values the FrameLayout
would pass down to its children, it became obvious that this is a bug.
See here for a full flavoured description and workaround.
Meta note: Thank you, StackOverflow reviewers, for voting for converting my original answer into a comment and then against marking this question as a duplicate. Now that's what you get for it. ;)