I guess I just havent found a good explanation here. So can anyone please tell me what android:stretchColumns
actually does? I have it in my table and have tried several different values but cannot seem to figure out what it is doing.
Sorry for the dumb question!
Stretching ColumnsThe specified columns are stretched to take up any available space on the row. Examples: android:stretchColumns="1"—The second column (because the column numbers are 0-based) is stretched to take up any available space in the row.
If marked as shrinkable, the column width can be shrunk to fit the table into its parent object. If marked as stretchable, it can expand in width to fit any extra space. The total width of the table is defined by its parent container. It is important to remember that a column can be both shrinkable and stretchable .
TableLayout is a ViewGroup that displays child View elements in rows and columns. Note: For better performance and tooling support, you should instead build your layout with ConstraintLayout. TableLayout positions its children into rows and columns.
This constant is a layoutMode . This constant is a layoutMode . This constant was deprecated in API level 28.
A TableLayout can specify certain columns as shrinkable or stretchable
by calling setColumnShrinkable() or setColumnStretchable(). If marked as shrinkable, the column width can be shrunk to fit the table into its parent object. If marked as stretchable, it can expand in width to fit any extra space. The total width of the table is defined by its parent container.
Have a look here, keep in mind that if your table fits nicely ( no space left to stretch) in the parent object, you would not see any changes no matter what value you put in.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With