balaji balaji - 26 days ago 8
Android Question

How to give space between column and row?

I created one simple table design, I am trying to give space between column and row still its not working?

This is my xml code and screen shot:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:shrinkColumns="*"
android:stretchColumns="*"
>

<TableRow
android:id="@+id/tableRow4"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<TextView
android:id="@+id/TextView04"
android:background="#800000"
android:text="Today"
android:textStyle="bold"
android:typeface="serif" />

<TextView
android:id="@+id/TextView05"
android:background="#2E8B57"
android:layout_alignParentRight="true"
android:text="6:00"
android:textStyle="bold"
android:typeface="serif" />
</TableRow>

<TableRow
android:id="@+id/tableRow1"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:id="@+id/TextView04"
android:text="Today"
android:textStyle="bold"
android:background="#800000"
android:typeface="serif"></TextView>
<TextView
android:id="@+id/TextView05"
android:text="6:00"
android:textStyle="bold"
android:background="#00FF7F"

android:typeface="serif"></TextView>
<TextView
android:id="@+id/TextView03"
android:text="6:30"
android:background="#800000"

android:textStyle="bold"
android:typeface="serif"></TextView>
<TextView
android:id="@+id/TextView02"
android:text="7:00"
android:background="#008000"

android:textStyle="bold"
android:typeface="serif"></TextView>
<TextView
android:id="@+id/TextView01"
android:text="7:30"
android:background="#FF00FF"

android:textStyle="bold"
android:typeface="serif"></TextView>
<TextView
android:text="8:00"
android:id="@+id/textView1"
android:background="#9400D3"

android:textStyle="bold"
android:typeface="serif"></TextView>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:id="@+id/tableRow2"


android:layout_width="match_parent">
<TextView
android:text="Star Sports"
android:id="@+id/textView2"
android:background="#00FF7F"

android:textStyle="bold"></TextView>
<TextView
android:id="@+id/textView3"
android:text="cricket1"
android:background="#FF00FF"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="cricket2"
android:id="@+id/textView4"
android:background="#FFD700"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="cricket3"
android:id="@+id/textView5"
android:background="#800000"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="cricket4"
android:id="@+id/textView6"
android:background="#9400D3"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="cricket5"
android:id="@+id/textView7"
android:background="#008000"

android:gravity="center_horizontal"></TextView>
</TableRow>
<TableRow
android:layout_height="wrap_content"
android:id="@+id/tableRow2"

android:layout_width="match_parent">
<TextView
android:text="Ten Sports"
android:background="#9400D3"

android:id="@+id/textView21"
android:textStyle="bold"></TextView>
<TextView
android:text="Foot Ball1"
android:background="#800000"

android:id="@+id/textView32"
android:gravity="center_horizontal"></TextView>
<TextView
android:text="Foot Ball2"
android:id="@+id/textView43"
android:background="#FF00FF"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="Foot Ball3"
android:id="@+id/textView54"
android:background="#008000"

android:gravity="center_horizontal"></TextView>
<TextView
android:text="Foot Ball4"
android:background="#FFD700"

android:id="@+id/textView65"
android:gravity="center_horizontal"></TextView>
<TextView
android:text="Foot Ball5"
android:id="@+id/textView76"
android:background="#00FF7F"

android:gravity="center_horizontal"></TextView>
</TableRow>

</TableLayout>

Answer

did you try android:layout_margin(Left|Right|Top|Bottom) ?