I want to align those inputs to have two autocomplete box on the right, on a smaller button on their right. However I end up with a large autocomplete (second one) covering everything.
<RelativeLayout
android:layout_alignParentBottom="true"
android:id="@+id/transport_search"
android:background="@color/dark_grey"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<AutoCompleteTextView
android:id="@+id/transport_autoCompleteFrom"
android:layout_width="fill_parent"
android:layout_weight="5"
></AutoCompleteTextView>
<Button
android:id="@+id/transport_switchDirection"
android:layout_toRightOf="@+id/transport_autoCompleteFrom"
android:layout_width="fill_parent"
android:layout_weight="1"
></Button>
<AutoCompleteTextView
android:id="@+id/transport_autoCompleteTo"
android:layout_width="fill_parent"
android:layout_weight="5"
></AutoCompleteTextView>
<Button
android:id="@+id/transport_go"
android:layout_toRightOf="@+id/transport_autoCompleteTo"
android:layout_width="fill_parent"
android:layout_weight="1"
></Button>
</RelativeLayout>
What am I doing wrong?
You can use LinearLayout inside RelativeLayout. Below shows two buttons in line:
<LinearLayout android:id="@+id/buttons" android:layout_below="@id/aboveControl1"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="horizontal" android:weightSum="2"
android:layout_alignLeft="@id/otherControl1" android:layout_alignRight="@id/otherControl2" >
<Button android:id="@+id/button10" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Ok" android:layout_weight="1" />
<Button android:id="@+id/button11" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Cancel" android:layout_weight="1" />
</LinearLayout>