Christian
Christian

Reputation: 942

get spacing between columns android sdk

I have four columns and four buttons I got them to all line up like I want it to, but they are all scrunched together. is there anyway to make it so that the layouts have spacing? this is what I have:

 <TableLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="4">

    <TableRow>

        <Button 
            android:layout_column="1"
            android:id="@+id/Button01" 
            android:onClick="OnClick" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/Button01">
        </Button>

        <Button 
            android:layout_column="2"
            android:id="@+id/Button02" 
            android:onClick="OnClick" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/Button02">
        </Button>

        <Button 
            android:layout_column="3"
            android:id="@+id/Button03" 
            android:onClick="OnClick" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/Button03" >
        </Button>

                    <Button 
            android:layout_column="4"
            android:id="@+id/Button04" 
            android:onClick="OnClick" 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:background="@drawable/Button04" >
        </Button>

    </TableRow>

</TableLayout>

Upvotes: 1

Views: 3432

Answers (2)

Hakan Ozbay
Hakan Ozbay

Reputation: 4719

You'll want to experiment with the android:layout_margin attribute on each of those Buttons. There's separate padding attributes for top,bottom,left and right.

Upvotes: 1

Christian
Christian

Reputation: 942

I figured something that works. I added more columns and in-between each column I add a blank transparent image. working pretty well.

Upvotes: 2

Related Questions