Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [XML Attrs](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#lattrs) \| [Inherited XML Attrs](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#inhattrs) \| [Inherited Constants](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#inhconstants) \| [Fields](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#lfields) \| [Inherited Fields](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#inhfields) \| [Ctors](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#pubctors) \| [Methods](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#pubmethods) \| [Protected Methods](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#promethods) \| [Inherited Methods](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#inhmethods)

# GridLayout.LayoutParams

*** ** * ** ***

` public static class GridLayout.LayoutParams `   
` ` ` ` ` extends https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams ` ` `

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||||
| ↳ | [android.view.ViewGroup.LayoutParams](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams) |||
|   | ↳ | [android.view.ViewGroup.MarginLayoutParams](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams) ||
|   |   | ↳ | android.widget.GridLayout.LayoutParams |

<br />

*** ** * ** ***

Layout information associated with each of the children of a GridLayout.

GridLayout supports both row and column spanning and arbitrary forms of alignment within each cell group. The fundamental parameters associated with each cell group are gathered into their vertical and horizontal components and stored in the `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec` and `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec` layout parameters. `https://developer.android.com/reference/android/widget/GridLayout.Spec` are immutable structures and may be shared between the layout parameters of different children.

The row and column specs contain the leading and trailing indices along each axis and together specify the four grid indices that delimit the cells of this cell group.

The alignment properties of the row and column specs together specify both aspects of alignment within the cell group. It is also possible to specify a child's alignment within its cell group by using the `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#setGravity(int)` method.

The weight property is also included in Spec and specifies the proportion of any excess space that is due to the associated view.

#### WRAP_CONTENT and MATCH_PARENT

Because the default values of the `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#width` and `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#height` properties are both `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#WRAP_CONTENT`, this value never needs to be explicitly declared in the layout parameters of GridLayout's children. In addition, GridLayout does not distinguish the special size value `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#MATCH_PARENT` from `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#WRAP_CONTENT`. A component's ability to expand to the size of the parent is instead controlled by the principle of *flexibility* , as discussed in `https://developer.android.com/reference/android/widget/GridLayout`.

#### Summary

You should not need to use either of the special size values: `WRAP_CONTENT` or `MATCH_PARENT` when configuring the children of a GridLayout.

#### Default values

- `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#width` = `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#WRAP_CONTENT`
- `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#height` = `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#WRAP_CONTENT`
- `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#topMargin` = 0 when `https://developer.android.com/reference/android/widget/GridLayout#setUseDefaultMargins(boolean)` is `false`; otherwise `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`, to indicate that a default value should be computed on demand.
- `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#leftMargin` = 0 when `https://developer.android.com/reference/android/widget/GridLayout#setUseDefaultMargins(boolean)` is `false`; otherwise `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`, to indicate that a default value should be computed on demand.
- `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#bottomMargin` = 0 when `https://developer.android.com/reference/android/widget/GridLayout#setUseDefaultMargins(boolean)` is `false`; otherwise `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`, to indicate that a default value should be computed on demand.
- `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#rightMargin` = 0 when `https://developer.android.com/reference/android/widget/GridLayout#setUseDefaultMargins(boolean)` is `false`; otherwise `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`, to indicate that a default value should be computed on demand.
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec``.row` = `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec``.rowSpan` = 1
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec``.alignment` = `https://developer.android.com/reference/android/widget/GridLayout#BASELINE`
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec``.weight` = 0
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec``.column` = `https://developer.android.com/reference/android/widget/GridLayout#UNDEFINED`
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec``.columnSpan` = 1
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec``.alignment` = `https://developer.android.com/reference/android/widget/GridLayout#START`
- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec``.weight` = 0

See `https://developer.android.com/reference/android/widget/GridLayout` for a more complete description of the conventions used by GridLayout in the interpretation of the properties of this class.

<br />

## Summary

| ### XML attributes ||
|---|---|
| [`android:layout_column`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_column) | The column boundary delimiting the left of the group of cells occupied by this view. |
| [`android:layout_columnSpan`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_columnSpan) | The column span: the difference between the right and left boundaries delimiting the group of cells occupied by this view. |
| [`android:layout_columnWeight`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_columnWeight) | The relative proportion of horizontal space that should be allocated to this view during excess space distribution. |
| [`android:layout_gravity`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_gravity) | Gravity specifies how a component should be placed in its group of cells. |
| [`android:layout_row`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_row) | The row boundary delimiting the top of the group of cells occupied by this view. |
| [`android:layout_rowSpan`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_rowSpan) | The row span: the difference between the top and bottom boundaries delimiting the group of cells occupied by this view. |
| [`android:layout_rowWeight`](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_rowWeight) | The relative proportion of vertical space that should be allocated to this view during excess space distribution. |

### Inherited XML attributes

From class `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams` [`android:layout_margin`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_margin) Specifies extra space on the left, top, right and bottom sides of this view. [`android:layout_marginBottom`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginBottom) Specifies extra space on the bottom side of this view. [`android:layout_marginEnd`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginEnd) Specifies extra space on the end side of this view. [`android:layout_marginHorizontal`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginHorizontal) Specifies extra space on the left and right sides of this view. [`android:layout_marginLeft`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginLeft) Specifies extra space on the left side of this view. [`android:layout_marginRight`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginRight) Specifies extra space on the right side of this view. [`android:layout_marginStart`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginStart) Specifies extra space on the start side of this view. [`android:layout_marginTop`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginTop) Specifies extra space on the top side of this view. [`android:layout_marginVertical`](https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#attr_android:layout_marginVertical) Specifies extra space on the top and bottom sides of this view. From class `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams` [`android:layout_height`](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#attr_android:layout_height) Specifies the basic height of the view. [`android:layout_width`](https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#attr_android:layout_width) Specifies the basic width of the view.

### Inherited constants

From class `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams` `int` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#FILL_PARENT`

Special value for the height or width requested by a View.
`int` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#MATCH_PARENT`

Special value for the height or width requested by a View.
`int` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#WRAP_CONTENT`

Special value for the height or width requested by a View.

| ### Fields ||
|---|---|
| ` public https://developer.android.com/reference/android/widget/GridLayout.Spec` | `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#columnSpec` The spec that defines the horizontal characteristics of the cell group described by these layout parameters. |
| ` public https://developer.android.com/reference/android/widget/GridLayout.Spec` | `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#rowSpec` The spec that defines the vertical characteristics of the cell group described by these layout parameters. |

### Inherited fields

From class `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams` ` public int` `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#bottomMargin`

The bottom margin in pixels of the child.
` public int` `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#leftMargin`

The left margin in pixels of the child.
` public int` `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#rightMargin`

The right margin in pixels of the child.
` public int` `https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#topMargin`

The top margin in pixels of the child.
From class `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams` ` public int` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#height`

Information about how tall the view wants to be.
` public https://developer.android.com/reference/android/view/animation/LayoutAnimationController.AnimationParameters` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#layoutAnimationParameters`

Used to animate layouts.
` public int` `https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#width`

Information about how wide the view wants to be.

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams()() ` Constructs a new LayoutParams with default values as defined in `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams`. |
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams(android.content.Context,%20android.util.AttributeSet)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/android/util/AttributeSet attrs) ` Values not defined in the attribute set take the default values defined in `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams`. |
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams(android.view.ViewGroup.LayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.LayoutParams params) ` <br /> |
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams(android.view.ViewGroup.MarginLayoutParams)(https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams params) ` <br /> |
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams(android.widget.GridLayout.LayoutParams)(https://developer.android.com/reference/android/widget/GridLayout.LayoutParams source) ` Copy constructor. |
| ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#LayoutParams(android.widget.GridLayout.Spec,%20android.widget.GridLayout.Spec)(https://developer.android.com/reference/android/widget/GridLayout.Spec rowSpec, https://developer.android.com/reference/android/widget/GridLayout.Spec columnSpec) ` Constructs a new LayoutParams instance for this `rowSpec` and `columnSpec`. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object o) ` Indicates whether some other object is "equal to" this one. |
| ` int` | ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#hashCode()() ` Returns a hash code value for the object. |
| ` void` | ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#setGravity(int)(int gravity) ` Describes how the child views are positioned. |

| ### Protected methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#setBaseAttributes(android.content.res.TypedArray,%20int,%20int)(https://developer.android.com/reference/android/content/res/TypedArray attributes, int widthAttr, int heightAttr) ` Extracts the layout parameters from the supplied attributes. |

### Inherited methods

From class ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams ` ` int` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#getLayoutDirection()() `

Retuns the layout direction.
` int` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#getMarginEnd()() `

Returns the end margin in pixels.
` int` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#getMarginStart()() `

Returns the start margin in pixels.
` boolean` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#isMarginRelative()() `

Check if margins are relative.
` void` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#resolveLayoutDirection(int)(int layoutDirection) `

This will be called by `https://developer.android.com/reference/android/view/View#requestLayout()`.
` void` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#setLayoutDirection(int)(int layoutDirection) `

Set the layout direction
` void` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#setMarginEnd(int)(int end) `

Sets the relative end margin.
` void` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#setMarginStart(int)(int start) `

Sets the relative start margin.
` void` ` https://developer.android.com/reference/android/view/ViewGroup.MarginLayoutParams#setMargins(int,%20int,%20int,%20int)(int left, int top, int right, int bottom) `

Sets the margins, in pixels.
From class ` https://developer.android.com/reference/android/view/ViewGroup.LayoutParams ` ` void` ` https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#resolveLayoutDirection(int)(int layoutDirection) `

Resolve layout parameters depending on the layout direction.
` void` ` https://developer.android.com/reference/android/view/ViewGroup.LayoutParams#setBaseAttributes(android.content.res.TypedArray,%20int,%20int)(https://developer.android.com/reference/android/content/res/TypedArray a, int widthAttr, int heightAttr) `

Extracts the layout parameters from the supplied attributes.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## XML attributes

### android:layout_column

The column boundary delimiting the left of the group of cells occupied by this view.

May be an integer value, such as "`100`".

<br />

### android:layout_columnSpan

The column span: the difference between the right and left boundaries delimiting the group of cells occupied by this view. The default is one. See `https://developer.android.com/reference/android/widget/GridLayout.Spec`.

May be an integer value, such as "`100`".

<br />

### android:layout_columnWeight

The relative proportion of horizontal space that should be allocated to this view during excess space distribution.

May be a floating point value, such as "`1.2`".

<br />

### android:layout_gravity

Gravity specifies how a component should be placed in its group of cells. The default is LEFT \| BASELINE. See `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#setGravity(int)`.

Must be one or more (separated by '\|') of the following constant values.

| Constant | Value | Description |
|---|---|---|
| bottom | 50 | Push object to the bottom of its container, not changing its size. |
| center | 11 | Place the object in the center of its container in both the vertical and horizontal axis, not changing its size. |
| center_horizontal | 1 | Place object in the horizontal center of its container, not changing its size. |
| center_vertical | 10 | Place object in the vertical center of its container, not changing its size. |
| clip_horizontal | 8 | Additional option that can be set to have the left and/or right edges of the child clipped to its container's bounds. The clip will be based on the horizontal gravity: a left gravity will clip the right edge, a right gravity will clip the left edge, and neither will clip both edges. |
| clip_vertical | 80 | Additional option that can be set to have the top and/or bottom edges of the child clipped to its container's bounds. The clip will be based on the vertical gravity: a top gravity will clip the bottom edge, a bottom gravity will clip the top edge, and neither will clip both edges. |
| end | 800005 | Push object to the end of its container, not changing its size. |
| fill | 77 | Grow the horizontal and vertical size of the object if needed so it completely fills its container. |
| fill_horizontal | 7 | Grow the horizontal size of the object if needed so it completely fills its container. |
| fill_vertical | 70 | Grow the vertical size of the object if needed so it completely fills its container. |
| left | 3 | Push object to the left of its container, not changing its size. |
| right | 5 | Push object to the right of its container, not changing its size. |
| start | 800003 | Push object to the beginning of its container, not changing its size. |
| top | 30 | Push object to the top of its container, not changing its size. |

<br />

<br />

**Related methods:**

- `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#setGravity(int)`

### android:layout_row

The row boundary delimiting the top of the group of cells occupied by this view.

May be an integer value, such as "`100`".

<br />

### android:layout_rowSpan

The row span: the difference between the top and bottom boundaries delimiting the group of cells occupied by this view. The default is one. See `https://developer.android.com/reference/android/widget/GridLayout.Spec`.

May be an integer value, such as "`100`".

<br />

### android:layout_rowWeight

The relative proportion of vertical space that should be allocated to this view during excess space distribution.

May be a floating point value, such as "`1.2`".

<br />

## Fields

### columnSpec

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GridLayout.Spec columnSpec
```

The spec that defines the horizontal characteristics of the cell group described by these layout parameters. If an assignment is made to this field after a measurement or layout operation has already taken place, a call to `https://developer.android.com/reference/android/view/View#setLayoutParams(android.view.ViewGroup.LayoutParams)` must be made to notify GridLayout of the change. GridLayout is normally able to detect when code fails to observe this rule, issue a warning and take steps to compensate for the omission. This facility is implemented on a best effort basis and should not be relied upon in production code - so it is best to include the above calls to remove the warnings as soon as it is practical.

<br />

### rowSpec

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GridLayout.Spec rowSpec
```

The spec that defines the vertical characteristics of the cell group described by these layout parameters. If an assignment is made to this field after a measurement or layout operation has already taken place, a call to `https://developer.android.com/reference/android/view/View#setLayoutParams(android.view.ViewGroup.LayoutParams)` must be made to notify GridLayout of the change. GridLayout is normally able to detect when code fails to observe this rule, issue a warning and take steps to compensate for the omission. This facility is implemented on a best effort basis and should not be relied upon in production code - so it is best to include the above calls to remove the warnings as soon as it is practical.

<br />

## Public constructors

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams ()
```

Constructs a new LayoutParams with default values as defined in `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams`.

<br />

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams (Context context, 
                AttributeSet attrs)
```

Values not defined in the attribute set take the default values defined in `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams`.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `attrs` | `AttributeSet` <br /> |

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams (ViewGroup.LayoutParams params)
```

<br />

<br />

| Parameters ||
|---|---|
| `params` | `ViewGroup.LayoutParams` <br /> |

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams (ViewGroup.MarginLayoutParams params)
```

<br />

<br />

| Parameters ||
|---|---|
| `params` | `ViewGroup.MarginLayoutParams` <br /> |

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams (GridLayout.LayoutParams source)
```

Copy constructor. Clones the width, height, margin values, row spec, and column spec of the source.

<br />

| Parameters ||
|---|---|
| `source` | `GridLayout.LayoutParams`: The layout params to copy from. <br /> |

### LayoutParams

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LayoutParams (GridLayout.Spec rowSpec, 
                GridLayout.Spec columnSpec)
```

Constructs a new LayoutParams instance for this `rowSpec` and `columnSpec`. All other fields are initialized with default values as defined in `https://developer.android.com/reference/android/widget/GridLayout.LayoutParams`.

<br />

| Parameters ||
|---|---|
| `rowSpec` | `GridLayout.Spec`: the rowSpec <br /> |
| `columnSpec` | `GridLayout.Spec`: the columnSpec <br /> |

## Public methods

### equals

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean equals (Object o)
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive*: for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric*: for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive*: for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent*: for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

<br />

| Parameters ||
|---|---|
| `o` | `Object`: This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### hashCode

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int hashCode ()
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/java/util/HashMap`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### setGravity

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setGravity (int gravity)
```

Describes how the child views are positioned. Default is `LEFT | BASELINE`. See `https://developer.android.com/reference/android/view/Gravity`.

<br />

**Related XML Attributes:**

- [android:layout_gravity](https://developer.android.com/reference/android/widget/GridLayout.LayoutParams#attr_android:layout_gravity)

| Parameters ||
|---|---|
| `gravity` | `int`: the new gravity value <br /> |

## Protected methods

### setBaseAttributes

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
protected void setBaseAttributes (TypedArray attributes, 
                int widthAttr, 
                int heightAttr)
```

Extracts the layout parameters from the supplied attributes.

<br />

| Parameters ||
|---|---|
| `attributes` | `TypedArray`: the style attributes to extract the parameters from <br /> |
| `widthAttr` | `int`: the identifier of the width attribute <br /> |
| `heightAttr` | `int`: the identifier of the height attribute <br /> |