2011-03-07 98 views
0

这里是我的xml:Android的布局问题

<?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> 

如何让我的最后RelativeLayout的是在屏幕的底部?我尝试了layout_gravity属性,但是没有任何效果。

+0

试试layout_alignwithparent – Phonon 2011-03-07 19:17:21

回答

1

我会考虑将整个事情包装在另一个RelativeLayout中。这样,只要您先关闭LinearLayout,您的内部RelativeLayout就可以使用android:layout_alignParentBottom =“true”。 Orientation也不是RelativeLayout的有效属性......事物是相对于彼此的,而不是定向的。

+0

这就是解决方案。 – 2011-03-07 21:30:55

1

试着把layout_weight放在你最大的元素上。这将导致它扩展和填充的空间,推你RelativeLayout的底部:

android:layout_weight="1" 

这也许应该在你的Gallery标签设置。