Added in API level 11

PropertyValuesHolder


open class PropertyValuesHolder : Cloneable
kotlin.Any
   ↳ android.animation.PropertyValuesHolder

This class holds information about a property and the values that that property should take on during an animation. PropertyValuesHolder objects can be used to create animations with ValueAnimator or ObjectAnimator that operate on several different properties in parallel.

Summary

Public methods
open PropertyValuesHolder

open String!

Gets the name of the property that will be animated.

open static PropertyValuesHolder!
ofFloat(propertyName: String!, vararg values: Float)

Constructs and returns a PropertyValuesHolder with a given property name and set of float values.

open static PropertyValuesHolder!
ofFloat(property: Property<*, Float!>!, vararg values: Float)

Constructs and returns a PropertyValuesHolder with a given property and set of float values.

open static PropertyValuesHolder!
ofInt(propertyName: String!, vararg values: Int)

Constructs and returns a PropertyValuesHolder with a given property name and set of int values.

open static PropertyValuesHolder!
ofInt(property: Property<*, Int!>!, vararg values: Int)

Constructs and returns a PropertyValuesHolder with a given property and set of int values.

open static PropertyValuesHolder!
ofKeyframe(propertyName: String!, vararg values: Keyframe!)

Constructs and returns a PropertyValuesHolder object with the specified property name and set of values.

open static PropertyValuesHolder!
ofKeyframe(property: Property<Any!, Any!>!, vararg values: Keyframe!)

Constructs and returns a PropertyValuesHolder object with the specified property and set of values.

open static PropertyValuesHolder!
ofMultiFloat(propertyName: String!, values: Array<FloatArray!>!)

Constructs and returns a PropertyValuesHolder with a given property name and set of float[] values.

open static PropertyValuesHolder!
ofMultiFloat(propertyName: String!, path: Path!)

Constructs and returns a PropertyValuesHolder with a given property name to use as a multi-float setter.

open static PropertyValuesHolder!
ofMultiFloat(propertyName: String!, converter: TypeConverter<V, FloatArray!>!, evaluator: TypeEvaluator<V>!, vararg values: V)

Constructs and returns a PropertyValuesHolder with a given property and set of Object values for use with ObjectAnimator multi-value setters.

open static PropertyValuesHolder!
ofMultiFloat(propertyName: String!, converter: TypeConverter<T, FloatArray!>!, evaluator: TypeEvaluator<T>!, vararg values: Keyframe!)

Constructs and returns a PropertyValuesHolder object with the specified property name or setter name for use in a multi-float setter function using ObjectAnimator.

open static PropertyValuesHolder!
ofMultiInt(propertyName: String!, values: Array<IntArray!>!)

Constructs and returns a PropertyValuesHolder with a given property name and set of int[] values.

open static PropertyValuesHolder!
ofMultiInt(propertyName: String!, path: Path!)

Constructs and returns a PropertyValuesHolder with a given property name to use as a multi-int setter.

open static PropertyValuesHolder!
ofMultiInt(propertyName: String!, converter: TypeConverter<V, IntArray!>!, evaluator: TypeEvaluator<V>!, vararg values: V)

Constructs and returns a PropertyValuesHolder with a given property and set of Object values for use with ObjectAnimator multi-value setters.

open static PropertyValuesHolder!
ofMultiInt(propertyName: String!, converter: TypeConverter<T, IntArray!>!, evaluator: TypeEvaluator<T>!, vararg values: Keyframe!)

Constructs and returns a PropertyValuesHolder object with the specified property name or setter name for use in a multi-int setter function using ObjectAnimator.

open static PropertyValuesHolder!
ofObject(propertyName: String!, evaluator: TypeEvaluator<Any!>!, vararg values: Any!)

Constructs and returns a PropertyValuesHolder with a given property name and set of Object values.

open static PropertyValuesHolder!
ofObject(propertyName: String!, converter: TypeConverter<PointF!, *>!, path: Path!)

Constructs and returns a PropertyValuesHolder with a given property name and a Path along which the values should be animated.

open static PropertyValuesHolder!
ofObject(property: Property<Any!, Any!>!, evaluator: TypeEvaluator<V>!, vararg values: V)

Constructs and returns a PropertyValuesHolder with a given property and set of Object values.

open static PropertyValuesHolder!
ofObject(property: Property<*, V>!, converter: TypeConverter<T, V>!, evaluator: TypeEvaluator<T>!, vararg values: T)

Constructs and returns a PropertyValuesHolder with a given property and set of Object values.

open static PropertyValuesHolder!
ofObject(property: Property<*, V>!, converter: TypeConverter<PointF!, V>!, path: Path!)

Constructs and returns a PropertyValuesHolder with a given property and a Path along which the values should be animated.

open Unit
setConverter(converter: TypeConverter<Any!, Any!>!)

Sets the converter to convert from the values type to the setter's parameter type.

open Unit

The TypeEvaluator will be automatically determined based on the type of values supplied to PropertyValuesHolder.

open Unit
setFloatValues(vararg values: Float)

Set the animated values for this object to this set of floats.

open Unit
setIntValues(vararg values: Int)

Set the animated values for this object to this set of ints.

open Unit
setKeyframes(vararg values: Keyframe!)

Set the animated values for this object to this set of Keyframes.

open Unit
setObjectValues(vararg values: Any!)

Set the animated values for this object to this set of Objects.

open Unit
setProperty(property: Property<Any!, Any!>!)

Sets the property that will be animated.

open Unit
setPropertyName(propertyName: String!)

Sets the name of the property that will be animated.

open String

Public methods

clone

Added in API level 11
open fun clone(): PropertyValuesHolder
Return
PropertyValuesHolder a clone of this instance.
Exceptions
java.lang.CloneNotSupportedException if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

getPropertyName

Added in API level 11
open fun getPropertyName(): String!

Gets the name of the property that will be animated. This name will be used to derive a setter function that will be called to set animated values. For example, a property name of foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

ofFloat

Added in API level 11
open static fun ofFloat(
    propertyName: String!,
    vararg values: Float
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and set of float values.

Parameters
propertyName String!: The name of the property being animated.
values Float: The values that the named property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofFloat

Added in API level 14
open static fun ofFloat(
    property: Property<*, Float!>!,
    vararg values: Float
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of float values.

Parameters
property Property<*, Float!>!: The property being animated. Should not be null.
values Float: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofInt

Added in API level 11
open static fun ofInt(
    propertyName: String!,
    vararg values: Int
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and set of int values.

Parameters
propertyName String!: The name of the property being animated.
values Int: The values that the named property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofInt

Added in API level 14
open static fun ofInt(
    property: Property<*, Int!>!,
    vararg values: Int
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of int values.

Parameters
property Property<*, Int!>!: The property being animated. Should not be null.
values Int: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofKeyframe

Added in API level 11
open static fun ofKeyframe(
    propertyName: String!,
    vararg values: Keyframe!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder object with the specified property name and set of values. These values can be of any type, but the type should be consistent so that an appropriate android.animation.TypeEvaluator can be found that matches the common type.

If there is only one value, it is assumed to be the end value of an animation, and an initial value will be derived, if possible, by calling a getter function on the object. Also, if any value is null, the value will be filled in when the animation starts in the same way. This mechanism of automatically getting null values only works if the PropertyValuesHolder object is used in conjunction ObjectAnimator, and with a getter function derived automatically from propertyName, since otherwise PropertyValuesHolder has no way of determining what the value should be.

Parameters
propertyName String!: The name of the property associated with this set of values. This can be the actual property name to be used when using a ObjectAnimator object, or just a name used to get animated values, such as if this object is used with an ValueAnimator object.
values Keyframe!: The set of values to animate between.

ofKeyframe

Added in API level 14
open static fun ofKeyframe(
    property: Property<Any!, Any!>!,
    vararg values: Keyframe!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder object with the specified property and set of values. These values can be of any type, but the type should be consistent so that an appropriate android.animation.TypeEvaluator can be found that matches the common type.

If there is only one value, it is assumed to be the end value of an animation, and an initial value will be derived, if possible, by calling the property's android.util.Property#get(Object) function. Also, if any value is null, the value will be filled in when the animation starts in the same way. This mechanism of automatically getting null values only works if the PropertyValuesHolder object is used in conjunction with ObjectAnimator, since otherwise PropertyValuesHolder has no way of determining what the value should be.

Parameters
property Property<Any!, Any!>!: The property associated with this set of values. Should not be null.
values Keyframe!: The set of values to animate between.

ofMultiFloat

Added in API level 21
open static fun ofMultiFloat(
    propertyName: String!,
    values: Array<FloatArray!>!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and set of float[] values. At least two float[] values must be supplied, a start and end value. If more values are supplied, the values will be animated from the start, through all intermediate values to the end value. When used with ObjectAnimator, the elements of the array represent the parameters of the setter function.

Parameters
propertyName String!: The name of the property being animated. Can also be the case-sensitive name of the entire setter method. Should not be null.
values Array<FloatArray!>!: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiFloat

Added in API level 21
open static fun ofMultiFloat(
    propertyName: String!,
    path: Path!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name to use as a multi-float setter. The values are animated along the path, with the first parameter of the setter set to the x coordinate and the second set to the y coordinate.

Parameters
propertyName String!: The name of the property being animated. Can also be the case-sensitive name of the entire setter method. Should not be null. The setter must take exactly two float parameters.
path Path!: The Path along which the values should be animated.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiFloat

Added in API level 21
@SafeVarargs open static fun <V : Any!> ofMultiFloat(
    propertyName: String!,
    converter: TypeConverter<V, FloatArray!>!,
    evaluator: TypeEvaluator<V>!,
    vararg values: V
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of Object values for use with ObjectAnimator multi-value setters. The Object values are converted to float[] using the converter.

Parameters
propertyName String!: The property being animated or complete name of the setter. Should not be null.
converter TypeConverter<V, FloatArray!>!: Used to convert the animated value to setter parameters.
evaluator TypeEvaluator<V>!: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values V: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiFloat

Added in API level 21
open static fun <T : Any!> ofMultiFloat(
    propertyName: String!,
    converter: TypeConverter<T, FloatArray!>!,
    evaluator: TypeEvaluator<T>!,
    vararg values: Keyframe!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder object with the specified property name or setter name for use in a multi-float setter function using ObjectAnimator. The values can be of any type, but the type should be consistent so that the supplied android.animation.TypeEvaluator can be used to to evaluate the animated value. The converter converts the values to parameters in the setter function.

At least two values must be supplied, a start and an end value.

Parameters
propertyName String!: The name of the property to associate with the set of values. This may also be the complete name of a setter function.
converter TypeConverter<T, FloatArray!>!: Converts values into float parameters for the setter. Can be null if the Keyframes have float[] values.
evaluator TypeEvaluator<T>!: Used to interpolate between values.
values Keyframe!: The values at specific fractional times to evaluate between
Return
PropertyValuesHolder! A PropertyValuesHolder for a multi-float parameter setter.

ofMultiInt

Added in API level 21
open static fun ofMultiInt(
    propertyName: String!,
    values: Array<IntArray!>!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and set of int[] values. At least two int[] values must be supplied, a start and end value. If more values are supplied, the values will be animated from the start, through all intermediate values to the end value. When used with ObjectAnimator, the elements of the array represent the parameters of the setter function.

Parameters
propertyName String!: The name of the property being animated. Can also be the case-sensitive name of the entire setter method. Should not be null.
values Array<IntArray!>!: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiInt

Added in API level 21
open static fun ofMultiInt(
    propertyName: String!,
    path: Path!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name to use as a multi-int setter. The values are animated along the path, with the first parameter of the setter set to the x coordinate and the second set to the y coordinate.

Parameters
propertyName String!: The name of the property being animated. Can also be the case-sensitive name of the entire setter method. Should not be null. The setter must take exactly two int parameters.
path Path!: The Path along which the values should be animated.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiInt

Added in API level 21
@SafeVarargs open static fun <V : Any!> ofMultiInt(
    propertyName: String!,
    converter: TypeConverter<V, IntArray!>!,
    evaluator: TypeEvaluator<V>!,
    vararg values: V
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of Object values for use with ObjectAnimator multi-value setters. The Object values are converted to int[] using the converter.

Parameters
propertyName String!: The property being animated or complete name of the setter. Should not be null.
converter TypeConverter<V, IntArray!>!: Used to convert the animated value to setter parameters.
evaluator TypeEvaluator<V>!: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values V: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofMultiInt

Added in API level 21
open static fun <T : Any!> ofMultiInt(
    propertyName: String!,
    converter: TypeConverter<T, IntArray!>!,
    evaluator: TypeEvaluator<T>!,
    vararg values: Keyframe!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder object with the specified property name or setter name for use in a multi-int setter function using ObjectAnimator. The values can be of any type, but the type should be consistent so that the supplied android.animation.TypeEvaluator can be used to to evaluate the animated value. The converter converts the values to parameters in the setter function.

At least two values must be supplied, a start and an end value.

Parameters
propertyName String!: The name of the property to associate with the set of values. This may also be the complete name of a setter function.
converter TypeConverter<T, IntArray!>!: Converts values into int parameters for the setter. Can be null if the Keyframes have int[] values.
evaluator TypeEvaluator<T>!: Used to interpolate between values.
values Keyframe!: The values at specific fractional times to evaluate between
Return
PropertyValuesHolder! A PropertyValuesHolder for a multi-int parameter setter.

ofObject

Added in API level 11
open static fun ofObject(
    propertyName: String!,
    evaluator: TypeEvaluator<Any!>!,
    vararg values: Any!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and set of Object values. This variant also takes a TypeEvaluator because the system cannot automatically interpolate between objects of unknown type.

Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the PropertyValuesHolder. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
propertyName String!: The name of the property being animated.
evaluator TypeEvaluator<Any!>!: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values Any!: The values that the named property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofObject

Added in API level 21
open static fun ofObject(
    propertyName: String!,
    converter: TypeConverter<PointF!, *>!,
    path: Path!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property name and a Path along which the values should be animated. This variant supports a TypeConverter to convert from PointF to the target type.

The PointF passed to converter or property, if converter is null, is reused on each animation frame and should not be stored by the setter or TypeConverter.

Parameters
propertyName String!: The name of the property being animated.
converter TypeConverter<PointF!, *>!: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path Path!: The Path along which the values should be animated.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofObject

Added in API level 14
@SafeVarargs open static fun <V : Any!> ofObject(
    property: Property<Any!, Any!>!,
    evaluator: TypeEvaluator<V>!,
    vararg values: V
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of Object values. This variant also takes a TypeEvaluator because the system cannot automatically interpolate between objects of unknown type.

Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the PropertyValuesHolder. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
property Property<Any!, Any!>!: The property being animated. Should not be null.
evaluator TypeEvaluator<V>!: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values V: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofObject

Added in API level 21
@SafeVarargs open static fun <T : Any!, V : Any!> ofObject(
    property: Property<*, V>!,
    converter: TypeConverter<T, V>!,
    evaluator: TypeEvaluator<T>!,
    vararg values: T
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and set of Object values. This variant also takes a TypeEvaluator because the system cannot automatically interpolate between objects of unknown type. This variant also takes a TypeConverter to convert from animated values to the type of the property. If only one value is supplied, the TypeConverter must be a android.animation.BidirectionalTypeConverter to retrieve the current value.

Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the PropertyValuesHolder. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
property Property<*, V>!: The property being animated. Should not be null.
converter TypeConverter<T, V>!: Converts the animated object to the Property type.
evaluator TypeEvaluator<T>!: A TypeEvaluator that will be called on each animation frame to provide the necessary interpolation between the Object values to derive the animated value.
values T: The values that the property will animate between.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

ofObject

Added in API level 21
open static fun <V : Any!> ofObject(
    property: Property<*, V>!,
    converter: TypeConverter<PointF!, V>!,
    path: Path!
): PropertyValuesHolder!

Constructs and returns a PropertyValuesHolder with a given property and a Path along which the values should be animated. This variant supports a TypeConverter to convert from PointF to the target type.

The PointF passed to converter or property, if converter is null, is reused on each animation frame and should not be stored by the setter or TypeConverter.

Parameters
property Property<*, V>!: The property being animated. Should not be null.
converter TypeConverter<PointF!, V>!: Converts a PointF to the type associated with the setter. May be null if conversion is unnecessary.
path Path!: The Path along which the values should be animated.
Return
PropertyValuesHolder! PropertyValuesHolder The constructed PropertyValuesHolder object.

setConverter

Added in API level 21
open fun setConverter(converter: TypeConverter<Any!, Any!>!): Unit

Sets the converter to convert from the values type to the setter's parameter type. If only one value is supplied, converter must be a android.animation.BidirectionalTypeConverter.

Parameters
converter TypeConverter<Any!, Any!>!: The converter to use to convert values.

setEvaluator

Added in API level 11
open fun setEvaluator(evaluator: TypeEvaluator<Any!>!): Unit

The TypeEvaluator will be automatically determined based on the type of values supplied to PropertyValuesHolder. The evaluator can be manually set, however, if so desired. This may be important in cases where either the type of the values supplied do not match the way that they should be interpolated between, or if the values are of a custom type or one not currently understood by the animation system. Currently, only values of type float and int (and their Object equivalents: Float and Integer) are correctly interpolated; all other types require setting a TypeEvaluator.

Parameters
evaluator TypeEvaluator<Any!>!:

setFloatValues

Added in API level 11
open fun setFloatValues(vararg values: Float): Unit

Set the animated values for this object to this set of floats. If there is only one value, it is assumed to be the end value of an animation, and an initial value will be derived, if possible, by calling a getter function on the object. Also, if any value is null, the value will be filled in when the animation starts in the same way. This mechanism of automatically getting null values only works if the PropertyValuesHolder object is used in conjunction ObjectAnimator, and with a getter function derived automatically from propertyName, since otherwise PropertyValuesHolder has no way of determining what the value should be.

Parameters
values Float: One or more values that the animation will animate between.

setIntValues

Added in API level 11
open fun setIntValues(vararg values: Int): Unit

Set the animated values for this object to this set of ints. If there is only one value, it is assumed to be the end value of an animation, and an initial value will be derived, if possible, by calling a getter function on the object. Also, if any value is null, the value will be filled in when the animation starts in the same way. This mechanism of automatically getting null values only works if the PropertyValuesHolder object is used in conjunction ObjectAnimator, and with a getter function derived automatically from propertyName, since otherwise PropertyValuesHolder has no way of determining what the value should be.

Parameters
values Int: One or more values that the animation will animate between.

setKeyframes

Added in API level 11
open fun setKeyframes(vararg values: Keyframe!): Unit

Set the animated values for this object to this set of Keyframes.

Parameters
values Keyframe!: One or more values that the animation will animate between.

setObjectValues

Added in API level 11
open fun setObjectValues(vararg values: Any!): Unit

Set the animated values for this object to this set of Objects. If there is only one value, it is assumed to be the end value of an animation, and an initial value will be derived, if possible, by calling a getter function on the object. Also, if any value is null, the value will be filled in when the animation starts in the same way. This mechanism of automatically getting null values only works if the PropertyValuesHolder object is used in conjunction ObjectAnimator, and with a getter function derived automatically from propertyName, since otherwise PropertyValuesHolder has no way of determining what the value should be.

Note: The Object values are stored as references to the original objects, which means that changes to those objects after this method is called will affect the values on the PropertyValuesHolder. If the objects will be mutated externally after this method is called, callers should pass a copy of those objects instead.

Parameters
values Any!: One or more values that the animation will animate between.

setProperty

Added in API level 14
open fun setProperty(property: Property<Any!, Any!>!): Unit

Sets the property that will be animated.

Note that if this PropertyValuesHolder object is used with ObjectAnimator, the property must exist on the target object specified in that ObjectAnimator.

Parameters
property Property<Any!, Any!>!: The property being animated.

setPropertyName

Added in API level 11
open fun setPropertyName(propertyName: String!): Unit

Sets the name of the property that will be animated. This name is used to derive a setter function that will be called to set animated values. For example, a property name of foo will result in a call to the function setFoo() on the target object. If either valueFrom or valueTo is null, then a getter function will also be derived and called.

Note that the setter function derived from this property name must take the same parameter type as the valueFrom and valueTo properties, otherwise the call to the setter function will fail.

Parameters
propertyName String!: The name of the property being animated.

toString

Added in API level 11
open fun toString(): String
Return
String a string representation of the object.