Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:stretchColumns

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!

like image 974
Mark Worsnop Avatar asked Jan 21 '11 01:01

Mark Worsnop


People also ask

What is stretch column android?

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.

What is shrink column?

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 .

What is a table layout in Android?

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.

Is table layout deprecated?

This constant is a layoutMode . This constant is a layoutMode . This constant was deprecated in API level 28.


1 Answers

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.

like image 63
SteD Avatar answered Sep 22 '22 12:09

SteD