# Ref

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/dsl/Ref.java+class:androidx.constraintlayout.core.dsl.Ref) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
class Ref
```

<br />

*** ** * ** ***

## Summary

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#addStringToReferences(java.lang.String,java.util.ArrayList<androidx.constraintlayout.core.dsl.Ref>)(str: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, refs: https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref!>!)` Add references in a String representation to a Ref ArrayList Used to add the Ref(s) property in the Config to references |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#getId()()` Get the Id of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#getPostMargin()()` Get the postMargin of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#getPreMargin()()` Get the preMargin of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#getWeight()()` Get the weight of the reference |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#parseFloat(java.lang.Object)(obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` Try to parse an object into a float number |
| `java-static https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#parseStringToRef(java.lang.String)(str: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#setId(java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Set the Id of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#setPostMargin(float)(postMargin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the postMargin of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#setPreMargin(float)(preMargin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the preMargin of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#setWeight(float)(weight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the weight of the reference |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref#toString()()` |

## Public functions

### addStringToReferences

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

```
java-static fun addStringToReferences(str: String!, refs: ArrayList<Ref!>!): Unit
```

Add references in a String representation to a Ref ArrayList Used to add the Ref(s) property in the Config to references

| Parameters |
|---|---|
| `str: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | references in a String representation |
| `refs: https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/Ref!>!` | a Ref ArrayList |

### getId

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

```
fun getId(): String!
```

Get the Id of the reference

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | the Id of the reference |

### getPostMargin

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

```
fun getPostMargin(): Float
```

Get the postMargin of the reference

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the preMargin of the reference |

### getPreMargin

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

```
fun getPreMargin(): Float
```

Get the preMargin of the reference

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the preMargin of the reference |

### getWeight

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

```
fun getWeight(): Float
```

Get the weight of the reference

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | the weight of the reference |

### parseFloat

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

```
java-static fun parseFloat(obj: Any!): Float
```

Try to parse an object into a float number

| Parameters |
|---|---|
| `obj: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` | object to be parsed |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | a number |

### parseStringToRef

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

```
java-static fun parseStringToRef(str: String!): Ref!
```

### setId

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

```
fun setId(id: String!): Unit
```

Set the Id of the reference

| Parameters |
|---|---|
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` |   |

### setPostMargin

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

```
fun setPostMargin(postMargin: Float): Unit
```

Set the postMargin of the reference

| Parameters |
|---|---|
| `postMargin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |

### setPreMargin

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

```
fun setPreMargin(preMargin: Float): Unit
```

Set the preMargin of the reference

| Parameters |
|---|---|
| `preMargin: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |

### setWeight

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

```
fun setWeight(weight: Float): Unit
```

Set the weight of the reference

| Parameters |
|---|---|
| `weight: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` |   |

### toString

```
fun toString(): String!
```