开发者

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">
       开发者_StackOverflow </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>


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜