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

*** ** * ** ***


```
public class GridEngine
```

<br />

*** ** * ** ***

GridEngine class contains the main logic of the Grid Helper

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#HORIZONTAL() = 0` |
| `static final int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#VERTICAL() = 1` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#GridEngine()()` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#GridEngine(int,int)(int rows, int columns)` |
| `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#GridEngine(int,int,int)(int rows, int columns, int numWidgets)` |

| ### Public methods |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#bottomOfWidget(int)(int i)` Get the boxView for the widget i to add a constraint on the bottom |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#leftOfWidget(int)(int i)` Get the boxView for the widget i to add a constraint on the left |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#rightOfWidget(int)(int i)` Get the boxView for the widget i to add a constraint on the right |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setColumns(int)(int columns)` set new columns value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setNumWidgets(int)(int num)` Set new NumWidgets value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setOrientation(int)(int orientation)` set new orientation value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setRows(int)(int rows)` set new rows value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setSkips(java.lang.String)(https://developer.android.com/reference/java/lang/String.html skips)` set new skips value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setSpans(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html spans)` set new spans value |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#setup()()` Set up the Grid engine. |
| `int` | `https://developer.android.com/reference/androidx/constraintlayout/core/utils/GridEngine#topOfWidget(int)(int i)` 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)

```
public static final int HORIZONTAL = 0
```

### VERTICAL

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

```
public static final int VERTICAL = 1
```

## Public constructors

### GridEngine

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

```
public GridEngine()
```

### GridEngine

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

```
public GridEngine(int rows, int columns)
```

### GridEngine

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

```
public GridEngine(int rows, int columns, int numWidgets)
```

## Public methods

### bottomOfWidget

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

```
public int bottomOfWidget(int i)
```

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

| Parameters |
|---|---|
| `int i` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `int` | 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)

```
public int leftOfWidget(int i)
```

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

| Parameters |
|---|---|
| `int i` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `int` | 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)

```
public int rightOfWidget(int i)
```

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

| Parameters |
|---|---|
| `int i` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `int` | 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)

```
public void setColumns(int columns)
```

set new columns value

| Parameters |
|---|---|
| `int columns` | new rows value |

### setNumWidgets

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

```
public void setNumWidgets(int num)
```

Set new NumWidgets value

| Parameters |
|---|---|
| `int num` | 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)

```
public void setOrientation(int orientation)
```

set new orientation value

| Parameters |
|---|---|
| `int orientation` | new orientation value |

### setRows

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

```
public void setRows(int rows)
```

set new rows value

| Parameters |
|---|---|
| `int rows` | new rows value |

### setSkips

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

```
public void setSkips(String skips)
```

set new skips value

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html skips` | new spans value |

### setSpans

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

```
public void setSpans(CharSequence spans)
```

set new spans value

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.html spans` | new spans value |

### setup

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

```
public void setup()
```

Set up the Grid engine.

### topOfWidget

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

```
public int topOfWidget(int i)
```

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

| Parameters |
|---|---|
| `int i` | the widget that has the order as i in the constraint_reference_ids |

| Returns |
|---|---|
| `int` | the boxView to add a constraint on the top |