# WeightedElementsComplicationData.Element

Artifact: [androidx.wear.watchface:watchface-complications-data](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/complications/data/Data.kt+class:androidx.wear.watchface.complications.data.WeightedElementsComplicationData.Element) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

*** ** * ** ***

<br />

```
class WeightedElementsComplicationData.Element
```

<br />

*** ** * ** ***

Describes a single value within a `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#Element(kotlin.Float,kotlin.Int)( weight: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, color: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |

| ### Public functions |
|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#hashCode()()` |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#toString()()` |

| ### Public properties |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#color()` The color of the Element, which must be used instead of the watch face's colors. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, fromInclusive = false) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#weight()` The weight of the Element which must be \> zero. |

## Public constructors

### Element

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
Element(
    weight: @FloatRange(from = 0.0, fromInclusive = false) Float,
    color: @ColorInt Int
)
```

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

```
open fun hashCode(): Int
```

### toString

```
open fun toString(): String
```

## Public properties

### color

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
val color: @ColorInt Int
```

The color of the Element, which must be used instead of the watch face's colors. This color needs to be meaningful to the user in conjunction with the other fields (e.g. blue is cold, red/yellow is warm). Tapping on the complication should launch an experience where the data is presented in more detail. Care must be taken to ensure the colors used are consistent with the launched experience.

### weight

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
val weight: @FloatRange(from = 0.0, fromInclusive = false) Float
```

The weight of the Element which must be \> zero. The size of the element when rendered should be proportional to its weight. Weights are not required to sum to any particular value.