i want to make the buttons take up half the width of the dialog each, thanks x3.
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:paddingBottom="10dp"
android:paddingLeft="10dp" android:paddingRight="10dp">
<TextView android:layout_width="fill_parent"
android:layout_height="1dip" android:background="#FFFFFF" android:id="@+id/seperator_line" />
<TextView android:layout_width="wrap_content"
开发者_运维百科 android:layout_height="wrap_content" android:id="@+id/text1"
android:text="Amount:" android:textColor="#FFFFFF"
android:layout_below="@id/seperator_line" android:padding="10dp" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/deleteButton_dialog"
android:layout_below="@id/text1" android:text="Delete" />
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/cancelButton_dialog"
android:text="Cancel" android:layout_toRightOf="@id/deleteButton_dialog"
android:layout_below="@id/text1" />
</RelativeLayout>
You can place them in a LinearLayout and then set the width to "fill_parent" and the layout_weight to "1". Like this:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@id/text1">
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/deleteButton_dialog"
android:text="Delete" />
<Button android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@+id/cancelButton_dialog"
android:text="Cancel"/>
</LinearLayout>
精彩评论