|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.view.View
android.view.ViewGroup
android.widget.LinearLayout
android.widget.TableRow
public class TableRow
A layout that arranges its children horizontally. A TableRow should
always be used as a child of a TableLayout. If a
TableRow's parent is not a TableLayout, the TableRow will behave as
an horizontal LinearLayout.
The children of a TableRow do not need to specify the
layout_width and layout_height attributes in the
XML file. TableRow always enforces those values to be respectively
ViewGroup.LayoutParams.FILL_PARENT and
ViewGroup.LayoutParams.WRAP_CONTENT.
Also see android.widget.TableRow.LayoutParams
for layout attributes
| Nested Class Summary | |
|---|---|
static class |
TableRow.LayoutParams
Set of layout parameters used in table rows. |
| Nested classes/interfaces inherited from class android.view.ViewGroup |
|---|
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener |
| Nested classes/interfaces inherited from class android.view.View |
|---|
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener |
| Field Summary |
|---|
| Fields inherited from class android.widget.LinearLayout |
|---|
HORIZONTAL, VERTICAL |
| Constructor Summary | |
|---|---|
TableRow(Context context)
Creates a new TableRow for the given context. |
|
TableRow(Context context,
AttributeSet attrs)
Creates a new TableRow for the given context and with the specified set attributes. |
|
| Method Summary | |
|---|---|
protected boolean |
checkLayoutParams(ViewGroup.LayoutParams p)
|
protected LinearLayout.LayoutParams |
generateDefaultLayoutParams()
Returns a set of layout parameters with a width of ViewGroup.LayoutParams.FILL_PARENT,
a height of ViewGroup.LayoutParams.WRAP_CONTENT and no spanning. |
TableRow.LayoutParams |
generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set. |
protected LinearLayout.LayoutParams |
generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params. |
(package private) int |
getChildrenSkipCount(View child,
int index)
Returns the number of children to skip after measuring/laying out the specified child. |
(package private) int[] |
getColumnsWidths(int widthMeasureSpec)
Measures the preferred width of each child, including its margins. |
(package private) int |
getLocationOffset(View child)
Return the location offset of the specified child. |
(package private) int |
getNextLocationOffset(View child)
Return the size offset of the next sibling of the specified child. |
View |
getVirtualChildAt(int i)
Returns the view at the specified index. |
int |
getVirtualChildCount()
Returns the virtual number of children. |
(package private) void |
measureChildBeforeLayout(View child,
int childIndex,
int widthMeasureSpec,
int totalWidth,
int heightMeasureSpec,
int totalHeight)
Measure the child according to the parent's measure specs. |
(package private) int |
measureNullChild(int childIndex)
Returns the size (width or height) that should be occupied by a null child. |
protected void |
onLayout(boolean changed,
int l,
int t,
int r,
int b)
Called from layout when this view should assign a size and position to each of its children. |
protected void |
onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the measured height. |
(package private) void |
setColumnCollapsed(int columnIndex,
boolean collapsed)
Collapses or restores a given column. |
(package private) void |
setColumnsWidthConstraints(int[] columnWidths)
Sets the width of all of the columns in this row. |
void |
setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
Register a callback to be invoked when a child is added to or removed from this view. |
| Methods inherited from class android.widget.LinearLayout |
|---|
getBaseline, getBaselineAlignedChildIndex, getOrientation, getWeightSum, isBaselineAligned, layoutHorizontal, layoutVertical, measureHorizontal, measureVertical, setBaselineAligned, setBaselineAlignedChildIndex, setGravity, setHorizontalGravity, setOrientation, setVerticalGravity, setWeightSum |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.view.ViewParent |
|---|
createContextMenu, getParent, isLayoutRequested, requestLayout |
| Constructor Detail |
|---|
public TableRow(Context context)
Creates a new TableRow for the given context.
context - the application environment
public TableRow(Context context,
AttributeSet attrs)
Creates a new TableRow for the given context and with the specified set attributes.
context - the application environmentattrs - a collection of attributes| Method Detail |
|---|
public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
setOnHierarchyChangeListener in class ViewGrouplistener - the callback to invoke on hierarchy change
void setColumnCollapsed(int columnIndex,
boolean collapsed)
Collapses or restores a given column.
columnIndex - the index of the columncollapsed - true if the column must be collapsed, false otherwise
protected void onMeasure(int widthMeasureSpec,
int heightMeasureSpec)
Measure the view and its content to determine the measured width and the
measured height. This method is invoked by View.measure(int, int) and
should be overriden by subclasses to provide accurate and efficient
measurement of their contents.
CONTRACT: When overriding this method, you
must call View.setMeasuredDimension(int, int) to store the
measured width and height of this view. Failure to do so will trigger an
IllegalStateException, thrown by
View.measure(int, int). Calling the superclass'
View.onMeasure(int, int) is a valid use.
The base class implementation of measure defaults to the background size,
unless a larger size is allowed by the MeasureSpec. Subclasses should
override View.onMeasure(int, int) to provide better measurements of
their content.
If this method is overridden, it is the subclass's responsibility to make
sure the measured height and width are at least the view's minimum height
and width (View.getSuggestedMinimumHeight() and
View.getSuggestedMinimumWidth()).
onMeasure in class LinearLayoutwidthMeasureSpec - horizontal space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.heightMeasureSpec - vertical space requirements as imposed by the parent.
The requirements are encoded with
View.MeasureSpec.View.getMeasuredWidth(),
View.getMeasuredHeight(),
View.setMeasuredDimension(int, int),
View.getSuggestedMinimumHeight(),
View.getSuggestedMinimumWidth(),
View.MeasureSpec.getMode(int),
View.MeasureSpec.getSize(int)
protected void onLayout(boolean changed,
int l,
int t,
int r,
int b)
onLayout in class LinearLayoutchanged - This is a new size or position for this viewl - Left position, relative to parentt - Top position, relative to parentr - Right position, relative to parentb - Bottom position, relative to parentpublic View getVirtualChildAt(int i)
Returns the view at the specified index. This method can be overriden
to take into account virtual children. Refer to
TableLayout and TableRow
for an example.
getVirtualChildAt in class LinearLayouti - the child's index
public int getVirtualChildCount()
Returns the virtual number of children. This number might be different
than the actual number of children if the layout can hold virtual
children. Refer to
TableLayout and TableRow
for an example.
getVirtualChildCount in class LinearLayoutint measureNullChild(int childIndex)
Returns the size (width or height) that should be occupied by a null child.
measureNullChild in class LinearLayoutchildIndex - the index of the null child
void measureChildBeforeLayout(View child,
int childIndex,
int widthMeasureSpec,
int totalWidth,
int heightMeasureSpec,
int totalHeight)
Measure the child according to the parent's measure specs. This
method should be overriden by subclasses to force the sizing of
children. This method is called by LinearLayout.measureVertical(int, int) and
LinearLayout.measureHorizontal(int, int).
measureChildBeforeLayout in class LinearLayoutchild - the child to measurechildIndex - the index of the child in this viewwidthMeasureSpec - horizontal space requirements as imposed by the parenttotalWidth - extra space that has been used up by the parent horizontallyheightMeasureSpec - vertical space requirements as imposed by the parenttotalHeight - extra space that has been used up by the parent vertically
int getChildrenSkipCount(View child,
int index)
Returns the number of children to skip after measuring/laying out the specified child.
getChildrenSkipCount in class LinearLayoutchild - the child after which we want to skip childrenindex - the index of the child after which we want to skip children
int getLocationOffset(View child)
Return the location offset of the specified child. This can be used by subclasses to change the location of a given widget.
getLocationOffset in class LinearLayoutchild - the child for which to obtain the location offset
int getNextLocationOffset(View child)
Return the size offset of the next sibling of the specified child.
This can be used by subclasses to change the location of the widget
following child.
getNextLocationOffset in class LinearLayoutchild - the child whose next sibling will be moved
int[] getColumnsWidths(int widthMeasureSpec)
Measures the preferred width of each child, including its margins.
widthMeasureSpec - the width constraint imposed by our parent
void setColumnsWidthConstraints(int[] columnWidths)
Sets the width of all of the columns in this row. At layout time,
this row sets a fixed width, as defined by columnWidths,
on each child (or cell, or column.)
columnWidths - the fixed width of each column that this row must
honor
IllegalArgumentException - when columnWidths' length is smaller
than the number of children in this row
public TableRow.LayoutParams generateLayoutParams(AttributeSet attrs)
generateLayoutParams in class LinearLayoutattrs - the attributes to build the layout parameters from
ViewGroup.LayoutParams or one
of its descendantsprotected LinearLayout.LayoutParams generateDefaultLayoutParams()
ViewGroup.LayoutParams.FILL_PARENT,
a height of ViewGroup.LayoutParams.WRAP_CONTENT and no spanning.
generateDefaultLayoutParams in class LinearLayoutprotected boolean checkLayoutParams(ViewGroup.LayoutParams p)
checkLayoutParams in class LinearLayoutprotected LinearLayout.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
ViewGroup.checkLayoutParams(android.view.ViewGroup.LayoutParams), this method
is invoked. This method should return a new set of layout params suitable for
this ViewGroup, possibly by copying the appropriate attributes from the
specified set of layout params.
generateLayoutParams in class LinearLayoutp - The layout parameters to convert into a suitable set of layout parameters
for this ViewGroup.
ViewGroup.LayoutParams or one
of its descendants
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||