# FloatRange

Artifact: [androidx.annotation:annotation](https://developer.android.com/jetpack/androidx/releases/annotation) [View Source](https://cs.android.com/search?q=file:androidx/annotation/FloatRange.kt+class:androidx.annotation.FloatRange) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/annotation#1.0.0)

*** ** * ** ***


```
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
@Target(allowedTargets = [AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.ANNOTATION_CLASS])
public annotation FloatRange
```

<br />

*** ** * ** ***

Denotes that the annotated element should be a float or double in the given range

Example:

```
@FloatRange(from=0.0,to=1.0)
public float getAlpha() {
    ...
}
```

## Summary

| ### Public methods |
|---|---|
| `final double` | `https://developer.android.com/reference/androidx/annotation/FloatRange#getFrom()()` Smallest value. |
| `final boolean` | `https://developer.android.com/reference/androidx/annotation/FloatRange#getFromInclusive()()` Whether the from value is included in the range |
| `final double` | `https://developer.android.com/reference/androidx/annotation/FloatRange#getTo()()` Largest value. |
| `final boolean` | `https://developer.android.com/reference/androidx/annotation/FloatRange#getToInclusive()()` Whether the to value is included in the range |

## Public methods

### getFrom

```
public final double getFrom()
```

Smallest value. Whether it is inclusive or not is determined by .fromInclusive

### getFromInclusive

```
public final boolean getFromInclusive()
```

Whether the from value is included in the range

### getTo

```
public final double getTo()
```

Largest value. Whether it is inclusive or not is determined by .toInclusive

### getToInclusive

```
public final boolean getToInclusive()
```

Whether the to value is included in the range