I have a vertical, set height (300px) LinearLayout (LL) with 3 nested LLs. 1 and 3rd are set with android:layout_height="wrap_content" and the middle one with android:layout_height="fill_parent". To my dismay, 3rd LL gets pushed out with 2nd one filling parent layout right to the bottom. How do I achieve desired effect since I want potentially resize the outside container with the middle portion expanding and contracting to accommodate the change
A:
You could create the following layout hierarchy (and set top
and bottom
to fixed heights):
<LinearLayout
android:id="@+id/top"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/center"
android:layout_height="fill_parent"/>
<LinearLayout
android:id="@+id/bottom"
android:layout_height="wrap_content"/>
</LinearLayout>
Josef
2009-08-01 15:50:49
+2
A:
Turned out (Thanks Mark Murphy for the answer) that all I was looking for was to set middle row to
layout_height="0px" and layout_weight="1"
DroidIn.net
2009-08-01 19:51:55
thanks a lot, worked out well
Amith GC
2010-07-19 09:48:32