public class TableView<T>
extends LinearLayout
TableDataAdapter
can be used.
For formatting the table headers the TableHeaderAdapter
can be used.Constructor and Description |
---|
TableView(Context context)
Creates a new TableView with the given context.
|
TableView(Context context,
AttributeSet attributes)
Creates a new TableView with the given context.
|
TableView(Context context,
AttributeSet attributes,
int styleAttributes)
Creates a new TableView with the given context.
|
Modifier and Type | Method and Description |
---|---|
void |
addDataClickListener(TableDataClickListener<T> listener)
Adds a
TableDataClickListener to this table. |
void |
addHeaderClickListener(TableHeaderClickListener listener)
Adds the given
TableHeaderClickListener to this table. |
int |
getColumnCount()
Gives the number of columns of this table.
|
int |
getColumnWeight(int columnIndex)
Gives the column weight (the relative width of the column) of the given column.
|
void |
removeHeaderListener(TableHeaderClickListener listener)
Removes the given
TableHeaderClickListener from this table. |
void |
removeTableDataClickListener(TableDataClickListener<T> listener)
Removes a
TableDataClickListener to this table. |
void |
setColumnCount(int columnCount)
Sets the number of columns of this table.
|
void |
setColumnWeight(int columnIndex,
int columnWeight)
Sets the column weight (the relative width of the column) of the given column.
|
void |
setDataAdapter(TableDataAdapter<T> dataAdapter)
Sets the
TableDataAdapter that is used to render the data view for each cell. |
void |
setDataRowColoriser(TableDataRowColoriser<? super T> coloriser)
Sets the given
TableDataRowColoriser that will be used to define the background color for
every table data row. |
void |
setHeaderAdapter(TableHeaderAdapter headerAdapter)
Sets the
TableHeaderAdapter that is used to render the header views for each column. |
void |
setHeaderBackground(int resId)
Sets the given resource as background of the table header.
|
void |
setHeaderBackgroundColor(int color)
Sets the given color as background of the table header.
|
void |
setHeaderElevation(int elevation)
Sets the elevation level of the header view.
|
public TableView(Context context)
new TableView(context, null, 0
)context
- The context that shall be used.public TableView(Context context, AttributeSet attributes)
new TableView(context, attrs, 0
)context
- The context that shall be used.attributes
- The attributes that shall be set to the view.public TableView(Context context, AttributeSet attributes, int styleAttributes)
context
- The context that shall be used.attributes
- The attributes that shall be set to the view.styleAttributes
- The style attributes that shall be set to the view.public void setHeaderBackground(int resId)
resId
- The if of the resource tht shall be set as background of the table header.public void setHeaderBackgroundColor(int color)
color
- The color that shall be set as background of the table header.public void setHeaderElevation(int elevation)
elevation
- The elevation that shall be set to the table header.public void setDataRowColoriser(TableDataRowColoriser<? super T> coloriser)
TableDataRowColoriser
that will be used to define the background color for
every table data row.coloriser
- The TableDataRowColoriser
that shall be used.public void addDataClickListener(TableDataClickListener<T> listener)
TableDataClickListener
to this table.listener
- The listener that should be added.public void removeTableDataClickListener(TableDataClickListener<T> listener)
TableDataClickListener
to this table.listener
- The listener that should be removed.public void addHeaderClickListener(TableHeaderClickListener listener)
TableHeaderClickListener
to this table.listener
- The listener that shall be added to this table.public void removeHeaderListener(TableHeaderClickListener listener)
TableHeaderClickListener
from this table.listener
- The listener that shall be removed from this table.public void setHeaderAdapter(TableHeaderAdapter headerAdapter)
TableHeaderAdapter
that is used to render the header views for each column.headerAdapter
- The TableHeaderAdapter
that should be set.public void setDataAdapter(TableDataAdapter<T> dataAdapter)
TableDataAdapter
that is used to render the data view for each cell.dataAdapter
- The TableDataAdapter
that should be set.public void setColumnCount(int columnCount)
columnCount
- The number of columns.public int getColumnCount()
public void setColumnWeight(int columnIndex, int columnWeight)
columnIndex
- The index of the column the weight should be set to.columnWeight
- The weight that should be set to the column.public int getColumnWeight(int columnIndex)
columnIndex
- The index of the column the weight should be returned.