My RelativeLayout contains several ImageView / TextView controls of varying heights, for example. 20, 70, 35. Controls enclosed in a row. I want them to increase their height to the same maximum control height, for example. 70. The problem is that with my layout, the RelativeLayout container and all controls expand to the height of the screen.
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <ImageView android:src="@drawable/image1" android:background="#FFCCDDEE" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerVertical="true" android:layout_alignParentLeft="true" /> <ImageView android:src="@drawable/image2" android:background="#FFCCDDEE" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerVertical="true" android:layout_centerInParent="true" /> <ImageView android:src="@drawable/image3" android:background="#FFCCDDEE" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_centerVertical="true" android:layout_alignParentRight="true" /> </RelativeLayout>
I can set the RelativeLayout height to 70, but I believe that I do not know how much the control size of the child is set in advance.
I can also achieve the desired effect using LinearLayout, but want to use RelativeLayout.
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <ImageView android:src="@drawable/image1" android:background="#FFCCDDEE" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center_vertical" /> <ImageView android:src="@drawable/image2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center_vertical" /> <ImageView android:src="@drawable/image3" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center_vertical" /> </LinearLayout>
Any ideas?
source share