# GridEngine

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/utils/GridEngine.java+class:androidx.constraintlayout.core.utils.GridEngine) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
class GridEngine
```

<br />

*** ** * ** ***

GridEngine class contains the main logic of the Grid Helper

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#HORIZONTAL() = 0` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#VERTICAL() = 1` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#GridEngine()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#GridEngine(int,int)(rows: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columns: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#GridEngine(int,int,int)(rows: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, columns: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, numWidgets: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#bottomOfWidget(int)(i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get the boxView for the widget i to add a constraint on the bottom |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#leftOfWidget(int)(i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get the boxView for the widget i to add a constraint on the left |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#rightOfWidget(int)(i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get the boxView for the widget i to add a constraint on the right |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setColumns(int)(columns: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` set new columns value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setNumWidgets(int)(num: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Set new NumWidgets value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setOrientation(int)(orientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` set new orientation value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setRows(int)(rows: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` set new rows value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setSkips(java.lang.String)(skips: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` set new skips value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setSpans(java.lang.CharSequence)(spans: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!)` set new spans value |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#setup()()` Set up the Grid engine. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/utils/GridEngine#topOfWidget(int)(i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Get the boxView for the widget i to add a constraint on the top |

## Constants

### HORIZONTAL

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
const val HORIZONTAL = 0: Int
```

### VERTICAL

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
const val VERTICAL = 1: Int
```

## Public constructors

### GridEngine

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
GridEngine()
```

### GridEngine

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
GridEngine(rows: Int, columns: Int)
```

### GridEngine

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
GridEngine(rows: Int, columns: Int, numWidgets: Int)
```

## Public functions

### bottomOfWidget

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun bottomOfWidget(i: Int): Int
```

Get the boxView for the widget i to add a constraint on the bottom

| Parameters |
|---|---|
| `i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the boxView to add a constraint on the bottom |

### leftOfWidget

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun leftOfWidget(i: Int): Int
```

Get the boxView for the widget i to add a constraint on the left

| Parameters |
|---|---|
| `i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the boxView to add a constraint on the left |

### rightOfWidget

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun rightOfWidget(i: Int): Int
```

Get the boxView for the widget i to add a constraint on the right

| Parameters |
|---|---|
| `i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the boxView to add a constraint on the right |

### setColumns

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setColumns(columns: Int): Unit
```

set new columns value

| Parameters |
|---|---|
| `columns: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | new rows value |

### setNumWidgets

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setNumWidgets(num: Int): Unit
```

Set new NumWidgets value

| Parameters |
|---|---|
| `num: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | how many widgets to be arranged in Grid |

### setOrientation

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setOrientation(orientation: Int): Unit
```

set new orientation value

| Parameters |
|---|---|
| `orientation: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | new orientation value |

### setRows

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setRows(rows: Int): Unit
```

set new rows value

| Parameters |
|---|---|
| `rows: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | new rows value |

### setSkips

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSkips(skips: String!): Unit
```

set new skips value

| Parameters |
|---|---|
| `skips: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | new spans value |

### setSpans

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpans(spans: CharSequence!): Unit
```

set new spans value

| Parameters |
|---|---|
| `spans: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!` | new spans value |

### setup

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setup(): Unit
```

Set up the Grid engine.

### topOfWidget

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun topOfWidget(i: Int): Int
```

Get the boxView for the widget i to add a constraint on the top

| Parameters |
|---|---|
| `i: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the boxView to add a constraint on the top |