I have two buttons, and I want to place them horizontally, so that they will be next to each other on the screen, there is no space left, I know that I can do this with a linear pause and set the weight, but I want relativelayout , because I already have weight in my XML, so there will be poor performance to put two weights into each other.
I tried like this
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/bg_selector" > <Button android:id="@+id/b_orderMeal_send" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginLeft="4dip" android:layout_marginRight="4dip" android:background="@drawable/button_selector" android:clickable="true" android:focusable="true" android:text="@string/b_send" android:textColor="#FFFFFF" /> <Button android:id="@+id/b_orderMeal_cancel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerHorizontal="true" android:layout_marginLeft="4dip" android:layout_marginRight="4dip" android:background="@drawable/button_selector" android:clickable="true" android:focusable="true" android:text="@string/b_cancel" android:textColor="#FFFFFF" /> </RelativeLayout>
But only a cancel button appears, and this is because I used the “fill in parent element”, what is the solution?
source share