I am trying to get a layout that looks something like this:

I.e:
TextView aligned (with margins) to parent left and top.- An
EditText left of the TextView , to the right of the Button and is aligned with the baseline with the TextView . - A
Button aligned (with right margin only) to parent right. And here is the broken part: aligned bottom to EditText .
For some reason this does not work. Here is the code that I expect to work:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="32dp" android:layout_marginTop="32dp" android:text="Text:" /> <EditText android:id="@+id/edit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/text" android:layout_toLeftOf="@+id/button" android:layout_toRightOf="@+id/text" android:ems="10" > <requestFocus /> </EditText> <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignBottom="@+id/edit" android:layout_marginRight="32dp" android:text="Ok" /> </RelativeLayout>
It looks like this:

What's happening?
Edit
Sorry, I'm not sure why I changed this example, but in my code I use ImageButton and not Button , so the solution cannot include alignment with the base level of the button - EditText should be aligned with the bottom (or middle, if possible) button .
source share