# ConstraintAttribute

Artifact: [androidx.constraintlayout:constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/widget/ConstraintAttribute.java+class:androidx.constraintlayout.widget.ConstraintAttribute) Added in [2.2.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#2.2.2)

*** ** * ** ***

<br />

```
class ConstraintAttribute
```

<br />

*** ** * ** ***

Defines non standard Attributes

## Summary

| ### Nested types |
|---|
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute.AttributeType` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#ConstraintAttribute(java.lang.String,androidx.constraintlayout.widget.ConstraintAttribute.AttributeType)( name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, attributeType: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute.AttributeType! )` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#ConstraintAttribute(androidx.constraintlayout.widget.ConstraintAttribute,java.lang.Object)(source: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#ConstraintAttribute(java.lang.String,androidx.constraintlayout.widget.ConstraintAttribute.AttributeType,java.lang.Object,boolean)( name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, attributeType: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute.AttributeType!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!, method: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html )` |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#applyCustom(android.view.View)(view: https://developer.android.com/reference/android/view/View.html!)` Apply custom attributes to the view |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#diff(androidx.constraintlayout.widget.ConstraintAttribute)(constraintAttribute: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!)` test if the two attributes are different |
| `java-static https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#extractAttributes(java.util.HashMap<java.lang.String,androidx.constraintlayout.widget.ConstraintAttribute>,android.view.View)(base: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!, view: https://developer.android.com/reference/android/view/View.html!)` extract attributes from the view |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getColorValue()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getFloatValue()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getIntegerValue()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getName()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getStringValue()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute.AttributeType!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getType()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getValueToInterpolate()()` Transforms value to a float for the purpose of interpolation |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#getValuesToInterpolate(float[])(ret: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!)` populate the float array with colors it will fill 4 values |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#isBooleanValue()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#isContinuous()()` Continuous types are interpolated they are fired only at |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#isMethod()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#numberOfInterpolatedValues()()` The number of interpolation values that need to be interpolated Typically 1 but 3 for colors. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#parse(android.content.Context,org.xmlpull.v1.XmlPullParser,java.util.HashMap<java.lang.String,androidx.constraintlayout.widget.ConstraintAttribute>)( context: https://developer.android.com/reference/android/content/Context.html!, parser: https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html!, custom: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>! )` parse Custom attributes and fill Custom |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setAttributes(android.view.View,java.util.HashMap<java.lang.String,androidx.constraintlayout.widget.ConstraintAttribute>)(view: https://developer.android.com/reference/android/view/View.html!, map: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!)` set attributes from map on to the view |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setColorValue(int)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setFloatValue(float)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setIntValue(int)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setStringValue(java.lang.String)(value: 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/widget/ConstraintAttribute#setValue(java.lang.Object)(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!)` set the value based on casting the object |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute#setValue(float[])(value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!)` setValue based on the values in the array |

## Public constructors

### ConstraintAttribute

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

```
ConstraintAttribute(
    name: String!,
    attributeType: ConstraintAttribute.AttributeType!
)
```

### ConstraintAttribute

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

```
ConstraintAttribute(source: ConstraintAttribute!, value: Any!)
```

### ConstraintAttribute

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

```
ConstraintAttribute(
    name: String!,
    attributeType: ConstraintAttribute.AttributeType!,
    value: Any!,
    method: Boolean
)
```

## Public functions

### applyCustom

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

```
fun applyCustom(view: View!): Unit
```

Apply custom attributes to the view

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |

### diff

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

```
fun diff(constraintAttribute: ConstraintAttribute!): Boolean
```

test if the two attributes are different

| Parameters |
|---|---|
| `constraintAttribute: https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!` |   |

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

### extractAttributes

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

```
java-static fun extractAttributes(base: HashMap<String!, ConstraintAttribute!>!, view: View!): HashMap<String!, ConstraintAttribute!>!
```

extract attributes from the view

| Parameters |
|---|---|
| `base: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!` |   |
| `view: https://developer.android.com/reference/android/view/View.html!` |   |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!` |   |

### getColorValue

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

```
fun getColorValue(): Int
```

### getFloatValue

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

```
fun getFloatValue(): Float
```

### getIntegerValue

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

```
fun getIntegerValue(): Int
```

### getName

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

```
fun getName(): String!
```

### getStringValue

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

```
fun getStringValue(): String!
```

### getType

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

```
fun getType(): ConstraintAttribute.AttributeType!
```

### getValueToInterpolate

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

```
fun getValueToInterpolate(): Float
```

Transforms value to a float for the purpose of interpolation

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

### getValuesToInterpolate

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

```
fun getValuesToInterpolate(ret: FloatArray<Float>!): Unit
```

populate the float array with colors it will fill 4 values

| Parameters |
|---|---|
| `ret: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` |   |

### isBooleanValue

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

```
fun isBooleanValue(): Boolean
```

### isContinuous

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

```
fun isContinuous(): Boolean
```

Continuous types are interpolated they are fired only at

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

### isMethod

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

```
fun isMethod(): Boolean
```

### numberOfInterpolatedValues

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

```
fun numberOfInterpolatedValues(): Int
```

The number of interpolation values that need to be interpolated Typically 1 but 3 for colors.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Typically 1 but 3 for colors. |

### parse

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

```
java-static fun parse(
    context: Context!,
    parser: XmlPullParser!,
    custom: HashMap<String!, ConstraintAttribute!>!
): Unit
```

parse Custom attributes and fill Custom

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` |   |
| `parser: https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser.html!` |   |
| `custom: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!` |   |

### setAttributes

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

```
java-static fun setAttributes(view: View!, map: HashMap<String!, ConstraintAttribute!>!): Unit
```

set attributes from map on to the view

| Parameters |
|---|---|
| `view: https://developer.android.com/reference/android/view/View.html!` |   |
| `map: https://developer.android.com/reference/java/util/HashMap.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, https://developer.android.com/reference/kotlin/androidx/constraintlayout/widget/ConstraintAttribute!>!` |   |

### setColorValue

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

```
fun setColorValue(value: Int): Unit
```

### setFloatValue

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

```
fun setFloatValue(value: Float): Unit
```

### setIntValue

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

```
fun setIntValue(value: Int): Unit
```

### setStringValue

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

```
fun setStringValue(value: String!): Unit
```

### setValue

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

```
fun setValue(value: Any!): Unit
```

set the value based on casting the object

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

### setValue

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

```
fun setValue(value: FloatArray<Float>!): Unit
```

setValue based on the values in the array

| Parameters |
|---|---|
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html>!` |   |