2011-03-07 107 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標籤設置。