开发者

Gravity is not set on Relative Layout

开发者 https://www.devze.com 2023-03-18 20:06 出处:网络
I am tackling relativeLayout problem in my application. I take one image and button. I want to make button is bottom of the image but is not set.

I am tackling relativeLayout problem in my application. I take one image and button. I want to make button is bottom of the image but is not set.

<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="wr开发者_开发技巧ap_content"
        android:layout_width="fill_parent"
        android:drawableBottom="@id/image"
        android:gravity="bottom" />
</RelativeLayout>


RelativeLayout uses android:layout_above and android:layout_below to position elements with regard to others. Changing your android:gravity="bottom" to android:layout_below="@id/image" should fix this.

0

精彩评论

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