TableLayout

A layout that arranges its children into rows and columns. A TableLayout consists of a number of TableRow objects, each defining a row (actually, you can have other children, which will be explained below). TableLayout containers do not display border lines for their rows, columns, or cells. Each row has zero or more cells; each cell can hold one View object. The table has as many columns as the row with the most cells. A table can leave cells empty. Cells can span columns, as they can in HTML.

Examples

A three-column table with some text content
<TableLayout width="fill_parent" stretchColumns="0 1 2">
	<TableRow>
		<TextView text="Item"/>
		<TextView text="Quantity"/>
		<TextView text="Price"/>
	</TableRow>
	<TableRow>
		<TextView text="Value 1" fontWeight="bold" />
		<TextView text="2" />
		<TextView text="100.00 $" />
	</TableRow>
	<TableRow>
		<TextView text="Value 2" fontWeight="bold" />
		<TextView text="1" />
		<TextView text="200.00 $" />
	</TableRow>
	<TableRow>
		<TextView text="SUM" fontWeight="bold" />
		<TextView text="1" />
		<TextView text="710.00 $" />
	</TableRow>
	<TableRow>
		<TextView text="Shipping" fontWeight="bold"
			tableColumnSpan="2" textHorizontalAlign="right" marginRight="10dp" />
		<TextView text="1.80 €" />
	</TableRow>
	<TableRow>
		<TextView tableColumn="2" text="711.80 $" />
	</TableRow>
</TableLayout>

Children

Views and/or Layouts

Attributes

Name Type Default Binding Description

Inherits all attributes from View and adds no attributes.

collapseColumns

list of unsigned int

The zero-based index of the columns to collapse. The column indices must be separated by a space: 1 2 5. Illegal and duplicate indices are ignored.

shrinkColumns

list of unsigned int

The zero-based index of the columns to shrink. The column indices must be separated by a space: 1 2 5. Illegal and duplicate indices are ignored.

stretchColumns

list of unsigned int

The zero-based index of the columns to stretch. The column indices must be separated by a space: 1 2 5. Illegal and duplicate indices are ignored.


Parts of this documentation are a derivate of the Android Developer Documentation by Google used under CC-BY-2.5.

results matching ""

    No results matching ""