# BoundsRule.ValueRule

Artifact: [androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/graphics/BoundsRule.java+class:androidx.leanback.graphics.BoundsRule.ValueRule) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***


```
public final class BoundsRule.ValueRule
```

<br />

*** ** * ** ***

This class represents individual rules for updating the bounds.

## Summary

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#absoluteValue(int)(int absoluteValue)` Creates ValueRule using an absolute value. |
| `int` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#getAbsoluteValue()()` |
| `float` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#getFraction()()` |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#inheritFromParent(float)(float fraction)` Creates ValueRule using a fraction of parent size. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#inheritFromParentWithOffset(float,int)(float fraction, int value)` Creates ValueRule of fraction and offset. |
| `void` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#setAbsoluteValue(int)(int absoluteValue)` Sets the absolute/offset value for rule. |
| `void` | `https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule#setFraction(float)(float fraction)` Sets the fractional value (percentage of parent) for this rule. |

## Public methods

### absoluteValue

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

```
public static @NonNull BoundsRule.ValueRule absoluteValue(int absoluteValue)
```

Creates ValueRule using an absolute value.

| Parameters |
|---|---|
| `int absoluteValue` | Absolute value. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | Newly created ValueRule. |

### getAbsoluteValue

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

```
public int getAbsoluteValue()
```

| Returns |
|---|---|
| `int` | The current absolute/offset value forrule. |

### getFraction

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

```
public float getFraction()
```

| Returns |
|---|---|
| `float` | The current fractional value. |

### inheritFromParent

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

```
public static @NonNull BoundsRule.ValueRule inheritFromParent(float fraction)
```

Creates ValueRule using a fraction of parent size.

| Parameters |
|---|---|
| `float fraction` | Percentage of parent. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | Newly created ValueRule. |

### inheritFromParentWithOffset

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

```
public static @NonNull BoundsRule.ValueRule inheritFromParentWithOffset(float fraction, int value)
```

Creates ValueRule of fraction and offset.

| Parameters |
|---|---|
| `float fraction` | Percentage of parent. |
| `int value` | Offset |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule` | Newly created ValueRule. |

### setAbsoluteValue

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

```
public void setAbsoluteValue(int absoluteValue)
```

Sets the absolute/offset value for rule.

| Parameters |
|---|---|
| `int absoluteValue` | Absolute value. |

### setFraction

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

```
public void setFraction(float fraction)
```

Sets the fractional value (percentage of parent) for this rule.

| Parameters |
|---|---|
| `float fraction` | Percentage of parent. |