Showing posts with label layout. Show all posts
Showing posts with label layout. Show all posts

November 16, 2010

[SOLVED] Android - Arrange two buttons next to each other and to center them horizontally.

Arrange two buttons next to each other and to center them horizontally.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="horizontal"
    android:background="@android:drawable/bottom_bar" android:paddingLeft="4.0dip"
    android:paddingTop="5.0dip" android:paddingRight="4.0dip"
    android:paddingBottom="1.0dip" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_below="@+id/TextView01">
    <Button android:id="@+id/allow" android:layout_width="0.0dip"
        android:layout_height="fill_parent" android:text="Allow"
        android:layout_weight="1.0" />
    <Button android:id="@+id/deny" android:layout_width="0.0dip"
        android:layout_height="fill_parent" android:text="Deny"
        android:layout_weight="1.0" />
</LinearLayout>

 

Source: stackoverflow.com

February 25, 2010

[SOLVED]Android: Column span in TableLayout


<!-- snipped -->
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*">
<TableRow>
<TextView android:id="@+id/info"
android:layout_span="3"
android:text="@string/info"
android:layout_gravity="center_horizontal" />
</TableRow>
<TableRow>
<Button android:id="@+id/button_add" android:text="+" />
<TextView android:text="@string/label" />
<TextView android:id="@+id/amount" />
</TableRow>
<!-- snipped -->
</TableLayout>
<!-- snipped -->


TableLayout supports column span on Android Development.