Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ValueRule

class ValueRule
kotlin.Any
   ↳ androidx.leanback.graphics.BoundsRule.ValueRule

This class represents individual rules for updating the bounds.

Summary

Public methods

static BoundsRule.ValueRule!
absoluteValue(absoluteValue: Int)

Creates ValueRule using an absolute value.

Int

Float

static BoundsRule.ValueRule!

Creates ValueRule using a fraction of parent size.

static BoundsRule.ValueRule!

Creates ValueRule of fraction and offset.

Unit
setAbsoluteValue(absoluteValue: Int)

Sets the absolute/offset value for rule.

Unit
setFraction(fraction: Float)

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

Public methods

absoluteValue

static fun absoluteValue(absoluteValue: Int): BoundsRule.ValueRule!

Creates ValueRule using an absolute value.

Parameters
absoluteValue Int: Absolute value.
Return
BoundsRule.ValueRule!: Newly created ValueRule.

getAbsoluteValue

fun getAbsoluteValue(): Int
Return
Int: The current absolute/offset value forrule.

getFraction

fun getFraction(): Float
Return
Float: The current fractional value.

inheritFromParent

static fun inheritFromParent(fraction: Float): BoundsRule.ValueRule!

Creates ValueRule using a fraction of parent size.

Parameters
fraction Float: Percentage of parent.
Return
BoundsRule.ValueRule!: Newly created ValueRule.

inheritFromParentWithOffset

static fun inheritFromParentWithOffset(fraction: Float, value: Int): BoundsRule.ValueRule!

Creates ValueRule of fraction and offset.

Parameters
fraction Float: Percentage of parent.
value Float: Offset
Return
BoundsRule.ValueRule!: Newly created ValueRule.

setAbsoluteValue

fun setAbsoluteValue(absoluteValue: Int): Unit

Sets the absolute/offset value for rule.

Parameters
absoluteValue Int: Absolute value.

setFraction

fun setFraction(fraction: Float): Unit

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

Parameters
fraction Float: Percentage of parent.