2011-07-07 128 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"应该可以解决这个问题。