views:

19

answers:

1

Greetings From Canada.

I was wondering how one might align two or more UI elements to the bottom of a screen instead of them just stacking as they normally do.

A: 

Something like this:

<RelativeLayout
android:id="@+id/myBottomLayout"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
   android:layout_alignParentBottom="true">
     <View
         android:id="@+id/leftItem"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content">
     <View
         android:id="@+id/rightItem"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         android:layout_toRightOf="id/leftItem">
</RelativeLayout>
lheezy
But I would like other things aligned to the top. Can I do that with this XML?
Mitchell
definitely, I forgot to mention that this code assumes the parent element is a RelativeLayout as well. To align to the top, make the other elements align to the top. This will work if the parent element is a RelativeLayout.
lheezy