I have the following layout set out in XML which is set as the content view of a dialog box
what I’m trying to do is center the two buttons so they appear in the center of the table row they are in, but no matter what i do to them they stay on the left. Is this something to do with it being inside a dialog? How can i fix it?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:background="#FF9E00"
android:orientation="vertical">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#A0DB84">
<TextView android:id="@+id/creatediagtxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEST"/>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#004884">
<Button android:id="@+id/Button01"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Cancel" android:layout_gravity="center"/>
<Button android:id="@+id/Button02"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Done" />
</TableRow>
</TableLayout>
You could play around with
layout_weight. For example: