tags:

views:

737

answers:

1

How can I have a layout where there is a view occupying most of the top of the screen and a bottom bar below it in the bottom of the screen without setting size for top view directly?

+4  A: 

You can set the top View's android:layout_weight set to "1", then you can set your bottom View's height and the top View will take up all remaining space. For example:

<LinearLayout android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_weight="1" />
<LinearLayout android:layout_width="fill_parent"
    android:layout_height="25dip" />

(Of course, if there is content in the bottom View, you can just set the height to "wrap_content" and have it set its own size based on its contents.)

Daniel Lew