1

I am implementing a table layout and adding table rows to it dynamically. I want give space between these rows. may I know how to do it. I am also adding a textView to the tableRow. I am declaring the table layout in the xml file. I tried giving padding inside the table row. But that seems to work within the tableRows and not between tableRows. please help.

Droidme
  • 1,223
  • 6
  • 25
  • 45
  • Can you please share with us what was it that you corrected ? I am having troubles setting space between columns in a tableLayout which is within a LinearLayout. –  Jul 15 '11 at 13:51

2 Answers2

3

You need to set the top or bottom margin of rows.

Here is an example: Programmatically set margin for TableRow

Community
  • 1
  • 1
Lumis
  • 21,517
  • 8
  • 63
  • 67
  • There may be something else in your layout which is preveting it, you need to experiment by starting with a simple working solution and then move to the complex final. – Lumis Mar 18 '11 at 14:53
  • I am declaring only the table layout in my layout file. rest I am doing it programatically. – Droidme Mar 19 '11 at 04:38
  • 1
    I got it. Thank you. As you said something else was preventing it. – Droidme Mar 19 '11 at 10:51
  • @Droidme:if u share the solution ..........with us we will be happy..... i am facing the same problem trying to set margin between rows programatically...thanks – sanjay Jan 12 '12 at 19:31
0

To set the margin between rows in a table layout you need to use the following XML

<Tablelayout> android:stretchColumns="*" </Tablelayout >
dandan78
  • 13,328
  • 13
  • 64
  • 78
Weloo
  • 625
  • 4
  • 16