Search code examples
androidandroid-layoutandroid-tablelayout

TableLayout row strech/shrink


I'm trying to fit a 20x20 table into a view using a programmatically built TableLayout. The setStretchAllColumns/setShrinkAllColumns methods work perfectly for squeezing all the columns in, but I haven't found a way to get all the rows in.

Is there a corresponding method for packing the rows in?


Solution

  • There aren't any setStretchAllColumns/setShrinkAllColumns for rows in a TableLayout. One thing that you could try(I haven't tested it) is to give your TableLayout a weigtSum of 20(with the method setWeightSum()) and then set the weight(the layout_weight attribute from a xml layout) of 1 for each of your 20 TableRows in the TableLayout.