/**@class android.widget.GridLayout @extends android.view.ViewGroup A layout that places its children in a rectangular <em>grid</em>. <p> The grid is composed of a set of infinitely thin lines that separate the viewing area into <em>cells</em>. Throughout the API, grid lines are referenced by grid <em>indices</em>. A grid with {@code N} columns has {@code N + 1} grid indices that run from {@code 0} through {@code N} inclusive. Regardless of how GridLayout is configured, grid index {@code 0} is fixed to the leading edge of the container and grid index {@code N} is fixed to its trailing edge (after padding is taken into account). <h4>Row and Column Specs</h4> Children occupy one or more contiguous cells, as defined by their {@link android.widget.GridLayout.LayoutParams#rowSpec rowSpec} and {@link android.widget.GridLayout.LayoutParams#columnSpec columnSpec} layout parameters. Each spec defines the set of rows or columns that are to be occupied; and how children should be aligned within the resulting group of cells. Although cells do not normally overlap in a GridLayout, GridLayout does not prevent children being defined to occupy the same cell or group of cells. In this case however, there is no guarantee that children will not themselves overlap after the layout operation completes. <h4>Default Cell Assignment</h4> If a child does not specify the row and column indices of the cell it wishes to occupy, GridLayout assigns cell locations automatically using its: {@link android.widget.GridLayout#setOrientation(int) orientation}, {@link android.widget.GridLayout#setRowCount(int) rowCount} and {@link android.widget.GridLayout#setColumnCount(int) columnCount} properties. <h4>Space</h4> Space between children may be specified either by using instances of the dedicated {@link android.widget.Space} view or by setting the {@link ViewGroup.MarginLayoutParams#leftMargin leftMargin}, {@link ViewGroup.MarginLayoutParams#topMargin topMargin}, {@link ViewGroup.MarginLayoutParams#rightMargin rightMargin} and {@link ViewGroup.MarginLayoutParams#bottomMargin bottomMargin} layout parameters. When the {@link android.widget.GridLayout#setUseDefaultMargins(boolean) useDefaultMargins} property is set, default margins around children are automatically allocated based on the prevailing UI style guide for the platform. Each of the margins so defined may be independently overridden by an assignment to the appropriate layout parameter. Default values will generally produce a reasonable spacing between components but values may change between different releases of the platform. <h4>Excess Space Distribution</h4> As of API 21, GridLayout's distribution of excess space accomodates the principle of weight. In the event that no weights are specified, the previous conventions are respected and columns and rows are taken as flexible if their views specify some form of alignment within their groups. <p> The flexibility of a view is therefore influenced by its alignment which is, in turn, typically defined by setting the {@link android.widget.AbsListView.LayoutParams#setGravity(int) gravity} property of the child's layout parameters. If either a weight or alignment were defined along a given axis then the component is taken as <em>flexible</em> in that direction. If no weight or alignment was set, the component is instead assumed to be <em>inflexible</em>. <p> Multiple components in the same row or column group are considered to act in <em>parallel</em>. Such a group is flexible only if <em>all</em> of the components within it are flexible. Row and column groups that sit either side of a common boundary are instead considered to act in <em>series</em>. The composite group made of these two elements is flexible if <em>one</em> of its elements is flexible. <p> To make a column stretch, make sure all of the components inside it define a weight or a gravity. To prevent a column from stretching, ensure that one of the components in the column does not define a weight or a gravity. <p> When the principle of flexibility does not provide complete disambiguation, GridLayout's algorithms favour rows and columns that are closer to its <em>right</em> and <em>bottom</em> edges. To be more precise, GridLayout treats each of its layout parameters as a constraint in the a set of variables that define the grid-lines along a given axis. During layout, GridLayout solves the constraints so as to return the unique solution to those constraints for which all variables are less-than-or-equal-to the corresponding value in any other valid solution. <h4>Interpretation of GONE</h4> For layout purposes, GridLayout treats views whose visibility status is {@link View#GONE GONE}, as having zero width and height. This is subtly different from the policy of ignoring views that are marked as GONE outright. If, for example, a gone-marked view was alone in a column, that column would itself collapse to zero width if and only if no gravity was defined on the view. If gravity was defined, then the gone-marked view has no effect on the layout and the container should be laid out as if the view had never been added to it. GONE views are taken to have zero weight during excess space distribution. <p> These statements apply equally to rows as well as columns, and to groups of rows or columns. <p> See {@link android.widget.GridLayout.LayoutParams} for a full description of the layout parameters used by GridLayout. @attr ref android.R.styleable#GridLayout_orientation @attr ref android.R.styleable#GridLayout_rowCount @attr ref android.R.styleable#GridLayout_columnCount @attr ref android.R.styleable#GridLayout_useDefaultMargins @attr ref android.R.styleable#GridLayout_rowOrderPreserved @attr ref android.R.styleable#GridLayout_columnOrderPreserved */ var GridLayout = { /** The horizontal orientation. */ HORIZONTAL : "0", /** The vertical orientation. */ VERTICAL : "1", /** The constant used to indicate that a value is undefined. Fields can use this value to indicate that their values have not yet been set. Similarly, methods can return this value to indicate that there is no suitable value that the implementation can return. The value used for the constant (currently {@link Integer#MIN_VALUE}) is intended to avoid confusion between valid values whose sign may not be known. */ UNDEFINED : "-2147483648", /** This constant is an {@link #setAlignmentMode(int) alignmentMode}. When the {@code alignmentMode} is set to {@link #ALIGN_BOUNDS}, alignment is made between the edges of each component's raw view boundary: i.e. the area delimited by the component's: {@link android.view.View#getTop() top}, {@link android.view.View#getLeft() left}, {@link android.view.View#getBottom() bottom} and {@link android.view.View#getRight() right} properties. <p> For example, when {@code GridLayout} is in {@link #ALIGN_BOUNDS} mode, children that belong to a row group that uses {@link #TOP} alignment will all return the same value when their {@link android.view.View#getTop()} method is called. @see #setAlignmentMode(int) */ ALIGN_BOUNDS : "0", /** This constant is an {@link #setAlignmentMode(int) alignmentMode}. When the {@code alignmentMode} is set to {@link #ALIGN_MARGINS}, the bounds of each view are extended outwards, according to their margins, before the edges of the resulting rectangle are aligned. <p> For example, when {@code GridLayout} is in {@link #ALIGN_MARGINS} mode, the quantity {@code top - layoutParams.topMargin} is the same for all children that belong to a row group that uses {@link #TOP} alignment. @see #setAlignmentMode(int) */ ALIGN_MARGINS : "1", /** Indicates that a view should be aligned with the <em>top</em> edges of the other views in its cell group. */ TOP : "null", /** Indicates that a view should be aligned with the <em>bottom</em> edges of the other views in its cell group. */ BOTTOM : "null", /** Indicates that a view should be aligned with the <em>start</em> edges of the other views in its cell group. */ START : "null", /** Indicates that a view should be aligned with the <em>end</em> edges of the other views in its cell group. */ END : "null", /** Indicates that a view should be aligned with the <em>left</em> edges of the other views in its cell group. */ LEFT : "null", /** Indicates that a view should be aligned with the <em>right</em> edges of the other views in its cell group. */ RIGHT : "null", /** Indicates that a view should be <em>centered</em> with the other views in its cell group. This constant may be used in both {@link android.widget.AbsListView.LayoutParams#rowSpec rowSpecs} and {@link android.widget.AbsListView.LayoutParams#columnSpec columnSpecs}. */ CENTER : "null", /** Indicates that a view should be aligned with the <em>baselines</em> of the other views in its cell group. This constant may only be used as an alignment in {@link android.widget.AbsListView.LayoutParams#rowSpec rowSpecs}. @see View#getBaseline() */ BASELINE : "null", /** Indicates that a view should expanded to fit the boundaries of its cell group. This constant may be used in both {@link android.widget.AbsListView.LayoutParams#rowSpec rowSpecs} and {@link android.widget.AbsListView.LayoutParams#columnSpec columnSpecs}. */ FILL : "null", /**Returns the current orientation. @return {Number} either {@link #HORIZONTAL} or {@link #VERTICAL} @see #setOrientation(int) @attr ref android.R.styleable#GridLayout_orientation */ getOrientation : function( ) {}, /**GridLayout uses the orientation property for two purposes: <ul> <li> To control the 'direction' in which default row/column indices are generated when they are not specified in a component's layout parameters. </li> <li> To control which axis should be processed first during the layout operation: when orientation is {@link #HORIZONTAL} the horizontal axis is laid out first. </li> </ul> The order in which axes are laid out is important if, for example, the height of one of GridLayout's children is dependent on its width - and its width is, in turn, dependent on the widths of other components. <p> If your layout contains a {@link android.widget.TextView} (or derivative: {@code Button}, {@code EditText}, {@code CheckBox}, etc.) which is in multi-line mode (the default) it is normally best to leave GridLayout's orientation as {@code HORIZONTAL} - because {@code TextView} is capable of deriving its height for a given width, but not the other way around. <p> Other than the effects above, orientation does not affect the actual layout operation of GridLayout, so it's fine to leave GridLayout in {@code HORIZONTAL} mode even if the height of the intended layout greatly exceeds its width. <p> The default value of this property is {@link #HORIZONTAL}. @param {Number} orientation either {@link #HORIZONTAL} or {@link #VERTICAL} @see #getOrientation() @attr ref android.R.styleable#GridLayout_orientation */ setOrientation : function( ) {}, /**Returns the current number of rows. This is either the last value that was set with {@link #setRowCount}(int) or, if no such value was set, the maximum value of each the upper bounds defined in {@link android.widget.AbsListView.LayoutParams#rowSpec}. @return {Number} the current number of rows @see #setRowCount(int) @see LayoutParams#rowSpec @attr ref android.R.styleable#GridLayout_rowCount */ getRowCount : function( ) {}, /**RowCount is used only to generate default row/column indices when they are not specified by a component's layout parameters. @param {Number} rowCount the number of rows @see #getRowCount() @see LayoutParams#rowSpec @attr ref android.R.styleable#GridLayout_rowCount */ setRowCount : function( ) {}, /**Returns the current number of columns. This is either the last value that was set with {@link #setColumnCount}(int) or, if no such value was set, the maximum value of each the upper bounds defined in {@link android.widget.AbsListView.LayoutParams#columnSpec}. @return {Number} the current number of columns @see #setColumnCount(int) @see LayoutParams#columnSpec @attr ref android.R.styleable#GridLayout_columnCount */ getColumnCount : function( ) {}, /**ColumnCount is used only to generate default column/column indices when they are not specified by a component's layout parameters. @param {Number} columnCount the number of columns. @see #getColumnCount() @see LayoutParams#columnSpec @attr ref android.R.styleable#GridLayout_columnCount */ setColumnCount : function( ) {}, /**Returns whether or not this GridLayout will allocate default margins when no corresponding layout parameters are defined. @return {Boolean} {@code true} if default margins should be allocated @see #setUseDefaultMargins(boolean) @attr ref android.R.styleable#GridLayout_useDefaultMargins */ getUseDefaultMargins : function( ) {}, /**When {@code true}, GridLayout allocates default margins around children based on the child's visual characteristics. Each of the margins so defined may be independently overridden by an assignment to the appropriate layout parameter. <p> When {@code false}, the default value of all margins is zero. <p> When setting to {@code true}, consider setting the value of the {@link #setAlignmentMode(int) alignmentMode} property to {@link #ALIGN_BOUNDS}. <p> The default value of this property is {@code false}. @param {Boolean} useDefaultMargins use {@code true} to make GridLayout allocate default margins @see #getUseDefaultMargins() @see #setAlignmentMode(int) @see ViewGroup.MarginLayoutParams#leftMargin @see ViewGroup.MarginLayoutParams#topMargin @see ViewGroup.MarginLayoutParams#rightMargin @see ViewGroup.MarginLayoutParams#bottomMargin @attr ref android.R.styleable#GridLayout_useDefaultMargins */ setUseDefaultMargins : function( ) {}, /**Returns the alignment mode. @return {Number} the alignment mode; either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS} @see #ALIGN_BOUNDS @see #ALIGN_MARGINS @see #setAlignmentMode(int) @attr ref android.R.styleable#GridLayout_alignmentMode */ getAlignmentMode : function( ) {}, /**Sets the alignment mode to be used for all of the alignments between the children of this container. <p> The default value of this property is {@link #ALIGN_MARGINS}. @param {Number} alignmentMode either {@link #ALIGN_BOUNDS} or {@link #ALIGN_MARGINS} @see #ALIGN_BOUNDS @see #ALIGN_MARGINS @see #getAlignmentMode() @attr ref android.R.styleable#GridLayout_alignmentMode */ setAlignmentMode : function( ) {}, /**Returns whether or not row boundaries are ordered by their grid indices. @return {Boolean} {@code true} if row boundaries must appear in the order of their indices, {@code false} otherwise @see #setRowOrderPreserved(boolean) @attr ref android.R.styleable#GridLayout_rowOrderPreserved */ isRowOrderPreserved : function( ) {}, /**When this property is {@code true}, GridLayout is forced to place the row boundaries so that their associated grid indices are in ascending order in the view. <p> When this property is {@code false} GridLayout is at liberty to place the vertical row boundaries in whatever order best fits the given constraints. <p> The default value of this property is {@code true}. @param {Boolean} rowOrderPreserved {@code true} to force GridLayout to respect the order of row boundaries @see #isRowOrderPreserved() @attr ref android.R.styleable#GridLayout_rowOrderPreserved */ setRowOrderPreserved : function( ) {}, /**Returns whether or not column boundaries are ordered by their grid indices. @return {Boolean} {@code true} if column boundaries must appear in the order of their indices, {@code false} otherwise @see #setColumnOrderPreserved(boolean) @attr ref android.R.styleable#GridLayout_columnOrderPreserved */ isColumnOrderPreserved : function( ) {}, /**When this property is {@code true}, GridLayout is forced to place the column boundaries so that their associated grid indices are in ascending order in the view. <p> When this property is {@code false} GridLayout is at liberty to place the horizontal column boundaries in whatever order best fits the given constraints. <p> The default value of this property is {@code true}. @param {Boolean} columnOrderPreserved use {@code true} to force GridLayout to respect the order of column boundaries. @see #isColumnOrderPreserved() @attr ref android.R.styleable#GridLayout_columnOrderPreserved */ setColumnOrderPreserved : function( ) {}, /**Return the printer that will log diagnostics from this layout. @see #setPrinter(android.util.Printer) @return {Object {android.util.Printer}} the printer associated with this view @hide */ getPrinter : function( ) {}, /**Set the printer that will log diagnostics from this layout. The default value is created by {@link android.util.LogPrinter}. @param {Object {Printer}} printer the printer associated with this layout @see #getPrinter() @hide */ setPrinter : function( ) {}, /** */ generateLayoutParams : function( ) {}, /** */ onViewAdded : function( ) {}, /** */ onViewRemoved : function( ) {}, /** */ requestLayout : function( ) {}, /** */ getAccessibilityClassName : function( ) {}, /**Return a Spec, {@code spec}, where: <ul> <li> {@code spec.span = [start, start + size]} </li> <li> {@code spec.alignment = alignment} </li> <li> {@code spec.weight = weight} </li> </ul> <p> To leave the start index undefined, use the value {@link #UNDEFINED}. @param {Number} start the start @param {Number} size the size @param {Object {GridLayout.Alignment}} alignment the alignment @param {Number} weight the weight */ spec : function( ) {}, /**Equivalent to: {@code spec(start, 1, alignment, weight)}. @param {Number} start the start @param {Object {GridLayout.Alignment}} alignment the alignment @param {Number} weight the weight */ spec : function( ) {}, /**Equivalent to: {@code spec(start, 1, default_alignment, weight)} - where {@code default_alignment} is specified in {@link android.widget.GridLayout.LayoutParams}. @param {Number} start the start @param {Number} size the size @param {Number} weight the weight */ spec : function( ) {}, /**Equivalent to: {@code spec(start, 1, weight)}. @param {Number} start the start @param {Number} weight the weight */ spec : function( ) {}, /**Equivalent to: {@code spec(start, size, alignment, 0f)}. @param {Number} start the start @param {Number} size the size @param {Object {GridLayout.Alignment}} alignment the alignment */ spec : function( ) {}, /**Return a Spec, {@code spec}, where: <ul> <li> {@code spec.span = [start, start + 1]} </li> <li> {@code spec.alignment = alignment} </li> </ul> <p> To leave the start index undefined, use the value {@link #UNDEFINED}. @param {Number} start the start index @param {Object {GridLayout.Alignment}} alignment the alignment @see #spec(int, int, Alignment) */ spec : function( ) {}, /**Return a Spec, {@code spec}, where: <ul> <li> {@code spec.span = [start, start + size]} </li> </ul> <p> To leave the start index undefined, use the value {@link #UNDEFINED}. @param {Number} start the start @param {Number} size the size @see #spec(int, Alignment) */ spec : function( ) {}, /**Return a Spec, {@code spec}, where: <ul> <li> {@code spec.span = [start, start + 1]} </li> </ul> <p> To leave the start index undefined, use the value {@link #UNDEFINED}. @param {Number} start the start index @see #spec(int, int) */ spec : function( ) {}, };