2011-07-07 127 views
0

我正在解決我的應用程序中的relativeLayout問題。 我拍攝一張圖片和一個按鈕。我想讓按鈕是圖像的底部,但沒有設置。未在相對佈局設置重力

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"> 
<ImageButton android:src="@drawable/layout_logo" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:id="@+id/image" /> 

<Button android:id="@+id/button3" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent" 
     android:drawableBottom="@id/image" 
     android:gravity="bottom" /> 
</RelativeLayout> 

回答

2

RelativeLayout使用android:layout_aboveandroid:layout_below定位對於其他元素。將你的android:gravity="bottom"更改爲android:layout_below="@id/image"應該可以解決這個問題。