问题
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?
回答1:
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 TableRow
s in the TableLayout
.
来源:https://stackoverflow.com/questions/9952895/tablelayout-row-strech-shrink