Build 1.0_r1(from source)

android.widget
Class TableLayout

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.LinearLayout
              extended by android.widget.TableLayout
All Implemented Interfaces:
Drawable.Callback, KeyEvent.Callback, ViewManager, ViewParent

public class TableLayout
extends LinearLayout

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.

The width of a column is defined by the row with the widest cell in that column. However, 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. It is important to remember that a column can be both shrinkable and stretchable. In such a situation, the column will change its size to always use up the available space, but never more. Finally, you can hide a column by calling setColumnCollapsed().

The children of a TableLayout cannot specify the layout_width attribute. Width is always FILL_PARENT. However, the layout_height attribute can be defined by a child; default value is ViewGroup.LayoutParams.WRAP_CONTENT. If the child is a TableRow, then the height is always ViewGroup.LayoutParams.WRAP_CONTENT.

Cells must be added to a row in increasing column order, both in code and XML. Column numbers are zero-based. If you don't specify a column number for a child cell, it will autoincrement to the next available column. If you skip a column number, it will be considered an empty cell in that row. See the TableLayout examples in ApiDemos for examples of creating tables in XML.

Although the typical child of a TableLayout is a TableRow, you can actually use any View subclass as a direct child of TableLayout. The View will be displayed as a single row that spans all the table columns.


Nested Class Summary
static class TableLayout.LayoutParams
          This set of layout parameters enforces the width of each child to be ViewGroup.LayoutParams.FILL_PARENT and the height of each child to be ViewGroup.LayoutParams.WRAP_CONTENT, but only if the height is not specified.
 
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
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FLAG_SUPPORT_STATIC_TRANSFORMATIONS, FLAG_USE_CHILD_DRAWING_ORDER, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, mDisappearingChildren, mGroupFlags, mOnHierarchyChangeListener, mPersistentDrawingCache, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIRST_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, INVISIBLE, KEEP_SCREEN_ON, LAST_STATE_SET, mBottom, mContext, mCurrentAnimation, MIDDLE_STATE_SET, mLayoutParams, mLeft, mLocation, mMeasuredHeight, mMeasuredWidth, mOnClickListener, mOnCreateContextMenuListener, mOnFocusChangeListener, mOnLongClickListener, mPaddingBottom, mPaddingLeft, mPaddingRight, mPaddingTop, mParent, mRight, mScrollX, mScrollY, mTag, mTop, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FIRST_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_LAST_STATE_SET, PRESSED_MIDDLE_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_SINGLE_STATE_SET, PRESSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SINGLE_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
TableLayout(Context context)
          Creates a new TableLayout for the given context.
TableLayout(Context context, AttributeSet attrs)
          Creates a new TableLayout for the given context and with the specified set attributes.
 
Method Summary
 void addView(View child)
          Adds a child view.
 void addView(View child, int index)
          Adds a child view.
 void addView(View child, int index, ViewGroup.LayoutParams params)
          Adds a child view with the specified layout parameters.
 void addView(View child, ViewGroup.LayoutParams params)
          Adds a child view with the specified layout parameters.
protected  boolean checkLayoutParams(ViewGroup.LayoutParams p)
          
protected  LinearLayout.LayoutParams generateDefaultLayoutParams()
          Returns a set of layout parameters with a width of ViewGroup.LayoutParams.FILL_PARENT, and a height of ViewGroup.LayoutParams.WRAP_CONTENT.
 TableLayout.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.
 boolean isColumnCollapsed(int columnIndex)
          Returns the collapsed state of the specified column.
 boolean isColumnShrinkable(int columnIndex)
          Returns whether the specified column is shrinkable or not.
 boolean isColumnStretchable(int columnIndex)
          Returns whether the specified column is stretchable or not.
 boolean isShrinkAllColumns()
          Indicates whether all columns are shrinkable or not.
 boolean isStretchAllColumns()
          Indicates whether all columns are stretchable or not.
(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)  void measureVertical(int widthMeasureSpec, int heightMeasureSpec)
          Measures the children when the orientation of this LinearLayout is set to LinearLayout.VERTICAL.
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.
 void requestLayout()
          Call this when something has changed which has invalidated the layout of this view.
 void setColumnCollapsed(int columnIndex, boolean isCollapsed)
          Collapses or restores a given column.
 void setColumnShrinkable(int columnIndex, boolean isShrinkable)
          Makes the given column shrinkable or not.
 void setColumnStretchable(int columnIndex, boolean isStretchable)
          Makes the given column stretchable or not.
 void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
          Register a callback to be invoked when a child is added to or removed from this view.
 void setShrinkAllColumns(boolean shrinkAllColumns)
          Convenience method to mark all columns as shrinkable.
 void setStretchAllColumns(boolean stretchAllColumns)
          Convenience method to mark all columns as stretchable.
 
Methods inherited from class android.widget.LinearLayout
getBaseline, getBaselineAlignedChildIndex, getChildrenSkipCount, getLocationOffset, getNextLocationOffset, getOrientation, getVirtualChildAt, getVirtualChildCount, getWeightSum, isBaselineAligned, layoutHorizontal, layoutVertical, measureHorizontal, measureNullChild, setBaselineAligned, setBaselineAlignedChildIndex, setGravity, setHorizontalGravity, setOrientation, setVerticalGravity, setWeightSum
 
Methods inherited from class android.view.ViewGroup
addFocusables, addStatesFromChildren, addTouchables, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, findViewTraversal, findViewWithTagTraversal, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetChildrenTopAndBottom, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setPadding, setPersistentDrawingCache, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
applyDrawableToTransparentRegion, bringToFront, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, debug, debugIndent, destroyDrawingCache, dispatchKeyShortcutEvent, draw, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInTouchMode, isLayoutRequested, isLongClickable, isPressed, isRootNamespace, isSaveEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAttachedToWindow, onCreateContextMenu, onDetachedFromWindow, onDraw, onFinishInflate, onFocusChanged, onKeyDown, onKeyMultiple, onKeyShortcut, onKeyUp, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onSizeChanged, onTouchEvent, onTrackballEvent, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setFrame, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setIsRootNamespace, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollBarStyle, setSelected, setSoundEffectsEnabled, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
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
 

Constructor Detail

TableLayout

public TableLayout(Context context)

Creates a new TableLayout for the given context.

Parameters:
context - the application environment

TableLayout

public TableLayout(Context context,
                   AttributeSet attrs)

Creates a new TableLayout for the given context and with the specified set attributes.

Parameters:
context - the application environment
attrs - a collection of attributes
Method Detail

setOnHierarchyChangeListener

public void setOnHierarchyChangeListener(ViewGroup.OnHierarchyChangeListener listener)
Register a callback to be invoked when a child is added to or removed from this view.

Overrides:
setOnHierarchyChangeListener in class ViewGroup
Parameters:
listener - the callback to invoke on hierarchy change

requestLayout

public void requestLayout()
Call this when something has changed which has invalidated the layout of this view. This will schedule a layout pass of the view tree.

Specified by:
requestLayout in interface ViewParent
Overrides:
requestLayout in class View

isShrinkAllColumns

public boolean isShrinkAllColumns()

Indicates whether all columns are shrinkable or not.

Returns:
true if all columns are shrinkable, false otherwise

setShrinkAllColumns

public void setShrinkAllColumns(boolean shrinkAllColumns)

Convenience method to mark all columns as shrinkable.

Parameters:
shrinkAllColumns - true to mark all columns shrinkable

isStretchAllColumns

public boolean isStretchAllColumns()

Indicates whether all columns are stretchable or not.

Returns:
true if all columns are stretchable, false otherwise

setStretchAllColumns

public void setStretchAllColumns(boolean stretchAllColumns)

Convenience method to mark all columns as stretchable.

Parameters:
stretchAllColumns - true to mark all columns stretchable

setColumnCollapsed

public void setColumnCollapsed(int columnIndex,
                               boolean isCollapsed)

Collapses or restores a given column. When collapsed, a column does not appear on screen and the extra space is reclaimed by the other columns. A column is collapsed/restored only when it belongs to a TableRow.

Calling this method requests a layout operation.

Parameters:
columnIndex - the index of the column
isCollapsed - true if the column must be collapsed, false otherwise

isColumnCollapsed

public boolean isColumnCollapsed(int columnIndex)

Returns the collapsed state of the specified column.

Parameters:
columnIndex - the index of the column
Returns:
true if the column is collapsed, false otherwise

setColumnStretchable

public void setColumnStretchable(int columnIndex,
                                 boolean isStretchable)

Makes the given column stretchable or not. When stretchable, a column takes up as much as available space as possible in its row.

Calling this method requests a layout operation.

Parameters:
columnIndex - the index of the column
isStretchable - true if the column must be stretchable, false otherwise. Default is false.

isColumnStretchable

public boolean isColumnStretchable(int columnIndex)

Returns whether the specified column is stretchable or not.

Parameters:
columnIndex - the index of the column
Returns:
true if the column is stretchable, false otherwise

setColumnShrinkable

public void setColumnShrinkable(int columnIndex,
                                boolean isShrinkable)

Makes the given column shrinkable or not. When a row is too wide, the table can reclaim extra space from shrinkable columns.

Calling this method requests a layout operation.

Parameters:
columnIndex - the index of the column
isShrinkable - true if the column must be shrinkable, false otherwise. Default is false.

isColumnShrinkable

public boolean isColumnShrinkable(int columnIndex)

Returns whether the specified column is shrinkable or not.

Parameters:
columnIndex - the index of the column
Returns:
true if the column is shrinkable, false otherwise. Default is false.

addView

public void addView(View child)
Adds a child view. If no layout parameters are already set on the child, the default parameters for this ViewGroup are set on the child.

Overrides:
addView in class ViewGroup
Parameters:
child - the child view to add
See Also:
ViewGroup.generateDefaultLayoutParams()

addView

public void addView(View child,
                    int index)
Adds a child view. If no layout parameters are already set on the child, the default parameters for this ViewGroup are set on the child.

Overrides:
addView in class ViewGroup
Parameters:
child - the child view to add
index - the position at which to add the child
See Also:
ViewGroup.generateDefaultLayoutParams()

addView

public void addView(View child,
                    ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters.

Specified by:
addView in interface ViewManager
Overrides:
addView in class ViewGroup
Parameters:
child - the child view to add
params - the layout parameters to set on the child

addView

public void addView(View child,
                    int index,
                    ViewGroup.LayoutParams params)
Adds a child view with the specified layout parameters.

Overrides:
addView in class ViewGroup
Parameters:
child - the child view to add
index - the position at which to add the child
params - the layout parameters to set on the child

onMeasure

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()).

Overrides:
onMeasure in class LinearLayout
Parameters:
widthMeasureSpec - 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.
See Also:
View.getMeasuredWidth(), View.getMeasuredHeight(), View.setMeasuredDimension(int, int), View.getSuggestedMinimumHeight(), View.getSuggestedMinimumWidth(), View.MeasureSpec.getMode(int), View.MeasureSpec.getSize(int)

onLayout

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. Derived classes with children should override this method and call layout on each of their their children.

Overrides:
onLayout in class LinearLayout
Parameters:
changed - This is a new size or position for this view
l - Left position, relative to parent
t - Top position, relative to parent
r - Right position, relative to parent
b - Bottom position, relative to parent

measureChildBeforeLayout

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).

Overrides:
measureChildBeforeLayout in class LinearLayout
Parameters:
child - the child to measure
childIndex - the index of the child in this view
widthMeasureSpec - horizontal space requirements as imposed by the parent
totalWidth - extra space that has been used up by the parent horizontally
heightMeasureSpec - vertical space requirements as imposed by the parent
totalHeight - extra space that has been used up by the parent vertically

measureVertical

void measureVertical(int widthMeasureSpec,
                     int heightMeasureSpec)
Measures the children when the orientation of this LinearLayout is set to LinearLayout.VERTICAL.

Overrides:
measureVertical in class LinearLayout
Parameters:
widthMeasureSpec - Horizontal space requirements as imposed by the parent.
heightMeasureSpec - Vertical space requirements as imposed by the parent.
See Also:
LinearLayout.getOrientation(), LinearLayout.setOrientation(int), LinearLayout.onMeasure(int, int)

generateLayoutParams

public TableLayout.LayoutParams generateLayoutParams(AttributeSet attrs)
Returns a new set of layout parameters based on the supplied attributes set.

Overrides:
generateLayoutParams in class LinearLayout
Parameters:
attrs - the attributes to build the layout parameters from
Returns:
an instance of ViewGroup.LayoutParams or one of its descendants

generateDefaultLayoutParams

protected LinearLayout.LayoutParams generateDefaultLayoutParams()
Returns a set of layout parameters with a width of ViewGroup.LayoutParams.FILL_PARENT, and a height of ViewGroup.LayoutParams.WRAP_CONTENT.

Overrides:
generateDefaultLayoutParams in class LinearLayout
Returns:
a set of default layout parameters or null

checkLayoutParams

protected boolean checkLayoutParams(ViewGroup.LayoutParams p)

Overrides:
checkLayoutParams in class LinearLayout

generateLayoutParams

protected LinearLayout.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
Returns a safe set of layout parameters based on the supplied layout params. When a ViewGroup is passed a View whose layout params do not pass the test of 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.

Overrides:
generateLayoutParams in class LinearLayout
Parameters:
p - The layout parameters to convert into a suitable set of layout parameters for this ViewGroup.
Returns:
an instance of ViewGroup.LayoutParams or one of its descendants

Build 1.0_r1(from source)

Please submit a feedback, bug or feature