added in version 25.4.0
belongs to Maven artifact com.android.support:support-dynamic-animation:28.0.0-alpha1

FloatValueHolder

public final class FloatValueHolder
extends Object

java.lang.Object
   ↳ android.support.animation.FloatValueHolder


FloatValueHolder holds a float value. FloatValueHolder provides a setter and a getter ( i.e. setValue(float) and getValue()) to access this float value. Animations can be performed on a FloatValueHolder instance. During each frame of the animation, the FloatValueHolder will have its value updated via setValue(float). The caller can obtain the up-to-date animation value via getValue().

Here is an example for creating a FlingAnimation with a FloatValueHolder:

 // Create a fling animation with an initial velocity of 5000 (pixel/s) and an initial position
 // of 20f.
 FloatValueHolder floatValueHolder = new FloatValueHolder(20f);
 FlingAnimation anim = new FlingAnimation(floatValueHolder).setStartVelocity(5000);
 anim.start();
 

Summary

Public constructors

FloatValueHolder()

Constructs a holder for a float value that is initialized to 0.

FloatValueHolder(float value)

Constructs a holder for a float value that is initialized to the input value.

Public methods

float getValue()

Returns the float value held in the FloatValueHolder instance.

void setValue(float value)

Sets the value held in the FloatValueHolder instance.

Inherited methods

From class java.lang.Object

Public constructors

FloatValueHolder

added in version 25.4.0
FloatValueHolder ()

Constructs a holder for a float value that is initialized to 0.

FloatValueHolder

added in version 25.4.0
FloatValueHolder (float value)

Constructs a holder for a float value that is initialized to the input value.

Parameters
value float: the value to initialize the value held in the FloatValueHolder

Public methods

getValue

added in version 25.4.0
float getValue ()

Returns the float value held in the FloatValueHolder instance.

Returns
float float value held in the FloatValueHolder instance

setValue

added in version 25.4.0
void setValue (float value)

Sets the value held in the FloatValueHolder instance.

Parameters
value float: float value held in the FloatValueHolder instance