I’m trying to implement a vertical LinearLayout where there’s fixed width bar in the bottom, fixed width bar in the top, and the middle area occupies the rest of the space. In the naive implementation
<LinearLayout android:layout_height="fill_parent"
android:orientation="vertical" >
<View android:layout_height="50sp"/>
<View android:layout_height="fill_parent"/>
<View android:layout_height="50sp"/>
</LinearLayout>
The top bar is there, but the bottom bar is invisible. I guess the layout process encounters fill_parent on the middle view, and assigns the rest of vertical space to it.
Is there some kind of gravity/weight trick that would make layout recognize and display the bottom bar?
Try setting the middle portions height using weight, like this.
This will draw the top and bottom first and than filling all ( weight = “1” ) REMAINING height with that view