Search code examples
androidlayoutspaceexpand

Dynamically expanding empty space?


Is there a way to separate upper content from lower content on the screen? So that no matter what's in the upper area the lower area remains against the bottom of the screen. I've tried gravity=bottom and things like that. I've tried inserting a layout of some kind in between top and bottom hoping it would stay expanded (thus pushing the two apart). Thanks for any help you can offer.


Solution

  • Answer: RelativeLayout

    Example:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TextView
            android:text="TOP"
            android:layout_alignParentTop="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </TextView>
        <TextView
            android:text="BOTTOM"
            android:layout_alignParentBottom="true"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
        </TextView>
    </RelativeLayout>