Musterknabe
Musterknabe

Reputation: 6081

Remove space between screen end and table start

I'm programmatically creating table layout so I can't do this with XML but have to do it with code. I have tables. But the distance from the side of the screen to the tables is too big. Is Android doing this on it's own? Is there a way to change it?

These here are my LayoutParams for the table

TableLayout.LayoutParams tableParams        = new TableLayout   .LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT);

tableLayout.setStretchAllColumns(true);
tableLayout.setShrinkAllColumns(true);                      
tableLayout.setPadding(1,0,0,1);
tableLayout.setBackgroundColor(Color.WHITE);
tableLayout.setLayoutParams(tableParams);
ll.addView(tableLayout)

So basically nothing special. How Can I change it that it is closer. For the padding I used

Left: 1px, Top: 0px, Right: 1px, Bottom: 1px.

So basically I don't know what to do to make it more width. Any suggestions? So basically I just want that my table is as width as the screen width. Or just some pixels smaller. Any ideas how I can achieve this? At the moment its too far away

Upvotes: 0

Views: 178

Answers (1)

Geobits
Geobits

Reputation: 22342

The padding is the interior space. You'll need to check/remove the padding on the LinearLayout that contains the TableLayout also.

If that doesn't do it completely, check/adjust the margin on both layouts as well.

Upvotes: 1

Related Questions