user468311
user468311

Reputation:

Android layout issue

Here's my xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical">
  <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <Button
     <!-- -->
    />
     <Button
     <!-- -->
    />
  </RelativeLayout>
  <TextView
    <!-- -->
  />
  <TextView
    <!-- -->
  />
  <Gallery 
    <!-- -->
  />
  <TextView
    <!-- -->
  />
   <TextView
    <!-- -->
  />
  <TextView
    <!-- -->
  />
   <TextView
   <!-- -->
  />
   <RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_gravity="bottom"

    >
    <Button
      <!-- -->
    />
     <Button
     <!-- -->
    />
    </RelativeLayout>
</LinearLayout>

How do I make my last RelativeLayout to be on the bottom of the screen? I tried layout_gravity attribute, but that had no effect.

Upvotes: 0

Views: 108

Answers (2)

Maximus
Maximus

Reputation: 8431

I would consider wrapping the whole thing in another RelativeLayout. That way your internal RelativeLayout could use the android:layout_alignParentBottom="true" as long as you close off the LinearLayout first. Also orientation is not a valid attribute for RelativeLayout... things are relative to each other, not directional.

Upvotes: 1

Matthew
Matthew

Reputation: 44919

Try putting a layout_weight on your biggest element. This will cause it to expand and fill the space, pushing your RelativeLayout to the bottom:

android:layout_weight="1"

This should probably be set on your Gallery tag.

Upvotes: 1

Related Questions