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

*** ** * ** ***


```
public final class WeightedElementsComplicationData.Element
```

<br />

*** ** * ** ***

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

## Summary

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

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#getColor()()` The color of the Element, which must be used instead of the watch face's colors. |
| `final float` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#getWeight()()` The weight of the Element which must be \> zero. |
| `int` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#hashCode()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/watchface/complications/data/WeightedElementsComplicationData.Element#toString()()` |

## Public constructors

### Element

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

```
public Element(
    @FloatRange(from = 0.0, fromInclusive = false) float weight,
    @ColorInt int color
)
```

## Public methods

### equals

```
public boolean equals(Object other)
```

### getColor

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

```
public final int getColor()
```

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.

### getWeight

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

```
public final float getWeight()
```

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.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```