开发者

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_gr开发者_StackOverflow社区avity attribute, but that had no effect.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜