# BoundsRule.ValueRule

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/graphics/BoundsRule.ValueRule "View this page in Java")

<br />

```
class BoundsRule.ValueRule
```

<br />

*** ** * ** ***

This class represents individual rules for updating the bounds.

## Summary

|                                                         ### Public functions                                                         |
|--------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule) | [absoluteValue](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#absoluteValue(int))`(absoluteValue: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Creates ValueRule using an absolute value.                                                                                                                       |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                          | [getAbsoluteValue](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#getAbsoluteValue())`()`                                                                                                                                                                                                                                                           |
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)                                                      | [getFraction](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#getFraction())`()`                                                                                                                                                                                                                                                                     |
| `java-static `[BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule) | [inheritFromParent](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#inheritFromParent(float))`(fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Creates ValueRule using a fraction of parent size.                                                                                                      |
| `java-static `[BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule) | [inheritFromParentWithOffset](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#inheritFromParentWithOffset(float,int))`(fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`, value: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Creates ValueRule of fraction and offset. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                        | [setAbsoluteValue](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#setAbsoluteValue(int))`(absoluteValue: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Sets the absolute/offset value for rule.                                                                                                                   |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                                        | [setFraction](https://developer.android.com/reference/kotlin/androidx/leanback/graphics/BoundsRule.ValueRule#setFraction(float))`(fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Sets the fractional value (percentage of parent) for this rule.                                                                                                     |

## Public functions

### absoluteValue

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

```
java-static fun absoluteValue(absoluteValue: Int): BoundsRule.ValueRule
```

Creates ValueRule using an absolute value.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|-----------------|
| `absoluteValue: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Absolute value. |

|                                                        Returns                                                         |
|------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/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)  

```
fun getAbsoluteValue(): Int
```  

|                                   Returns                                   |
|-----------------------------------------------------------------------------|--------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The current absolute/offset value forrule. |

### getFraction

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

```
fun getFraction(): Float
```  

|                                     Returns                                     |
|---------------------------------------------------------------------------------|-------------------------------|
| [Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The current fractional value. |

### inheritFromParent

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

```
java-static fun inheritFromParent(fraction: Float): BoundsRule.ValueRule
```

Creates ValueRule using a fraction of parent size.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|-----------------------|
| `fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Percentage of parent. |

|                                                        Returns                                                         |
|------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/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)  

```
java-static fun inheritFromParentWithOffset(fraction: Float, value: Int): BoundsRule.ValueRule
```

Creates ValueRule of fraction and offset.  

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|-----------------------|
| `fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Percentage of parent. |
| `value: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)        | Offset                |

|                                                        Returns                                                         |
|------------------------------------------------------------------------------------------------------------------------|--------------------------|
| [BoundsRule.ValueRule](https://developer.android.com/reference/kotlin/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)  

```
fun setAbsoluteValue(absoluteValue: Int): Unit
```

Sets the absolute/offset value for rule.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|-----------------|
| `absoluteValue: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | Absolute value. |

### setFraction

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

```
fun setFraction(fraction: Float): Unit
```

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

|                                         Parameters                                          |
|---------------------------------------------------------------------------------------------|-----------------------|
| `fraction: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | Percentage of parent. |