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.FloatValueHolderfloatValueHolder=newFloatValueHolder(20f);FlingAnimationanim=newFlingAnimation(floatValueHolder).setStartVelocity(5000);anim.start();
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# FloatValueHolder\n\nadded in [version 25.4.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:support-dynamic-animation:28.0.0-alpha1 \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nFloatValueHolder\n================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\nfinal\n\nclass\nFloatValueHolder\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------------------------------|\n| java.lang.Object ||\n| ↳ | android.support.animation.FloatValueHolder |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nFloatValueHolder holds a float value. FloatValueHolder provides a setter and a getter (\ni.e. [setValue(float)](/reference/android/support/animation/FloatValueHolder#setValue(float)) and [getValue()](/reference/android/support/animation/FloatValueHolder#getValue())) to access this float value. Animations can\nbe performed on a FloatValueHolder instance. During each frame of the animation, the\nFloatValueHolder will have its value updated via [setValue(float)](/reference/android/support/animation/FloatValueHolder#setValue(float)). The caller can\nobtain the up-to-date animation value via [getValue()](/reference/android/support/animation/FloatValueHolder#getValue()).\n\nHere is an example for creating a [FlingAnimation](/reference/android/support/animation/FlingAnimation) with a FloatValueHolder: \n\n```scilab\n // Create a fling animation with an initial velocity of 5000 (pixel/s) and an initial position\n // of 20f.\n FloatValueHolder floatValueHolder = new FloatValueHolder(20f);\n FlingAnimation anim = new FlingAnimation(floatValueHolder).setStartVelocity(5000);\n anim.start();\n \n```\n\n\u003cbr /\u003e\n\n**See also:**\n\n- [SpringAnimation(FloatValueHolder)](/reference/android/support/animation/SpringAnimation#SpringAnimation(android.support.animation.FloatValueHolder))\n- [FlingAnimation(FloatValueHolder)](/reference/android/support/animation/FlingAnimation#FlingAnimation(android.support.animation.FloatValueHolder))\n\nSummary\n-------\n\n| ### Public constructors ||\n|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[FloatValueHolder](/reference/android/support/animation/FloatValueHolder#FloatValueHolder())`() ` Constructs a holder for a float value that is initialized to 0. |\n| ` `[FloatValueHolder](/reference/android/support/animation/FloatValueHolder#FloatValueHolder(float))`(float value) ` Constructs a holder for a float value that is initialized to the input value. |\n\n| ### Public methods ||\n|----------|------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` float` | ` `[getValue](/reference/android/support/animation/FloatValueHolder#getValue())`() ` Returns the float value held in the FloatValueHolder instance. |\n| ` void` | ` `[setValue](/reference/android/support/animation/FloatValueHolder#setValue(float))`(float value) ` Sets the value held in the FloatValueHolder instance. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n\nPublic constructors\n-------------------\n\n### FloatValueHolder\n\nadded in [version 25.4.0](/topic/libraries/support-library/revisions) \n\n```\nFloatValueHolder ()\n```\n\nConstructs a holder for a float value that is initialized to 0.\n\n\u003cbr /\u003e\n\n### FloatValueHolder\n\nadded in [version 25.4.0](/topic/libraries/support-library/revisions) \n\n```\nFloatValueHolder (float value)\n```\n\nConstructs a holder for a float value that is initialized to the input value.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|--------------------------------------------------------------------------------|\n| `value` | `float`: the value to initialize the value held in the FloatValueHolder \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### getValue\n\nadded in [version 25.4.0](/topic/libraries/support-library/revisions) \n\n```\nfloat getValue ()\n```\n\nReturns the float value held in the FloatValueHolder instance.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------|----------------------------------------------------------|\n| `float` | float value held in the FloatValueHolder instance \u003cbr /\u003e |\n\n### setValue\n\nadded in [version 25.4.0](/topic/libraries/support-library/revisions) \n\n```\nvoid setValue (float value)\n```\n\nSets the value held in the FloatValueHolder instance.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-------------------------------------------------------------------|\n| `value` | `float`: float value held in the FloatValueHolder instance \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [DynamicAnimation.OnAnimationEndListener](/reference/android/support/animation/DynamicAnimation.OnAnimationEndListener)\n - [DynamicAnimation.OnAnimationUpdateListener](/reference/android/support/animation/DynamicAnimation.OnAnimationUpdateListener)\n-\n\n Classes\n -------\n\n - [DynamicAnimation](/reference/android/support/animation/DynamicAnimation)\n - [DynamicAnimation.ViewProperty](/reference/android/support/animation/DynamicAnimation.ViewProperty)\n - [FlingAnimation](/reference/android/support/animation/FlingAnimation)\n - [FloatPropertyCompat](/reference/android/support/animation/FloatPropertyCompat)\n - [FloatValueHolder](/reference/android/support/animation/FloatValueHolder)\n - [SpringAnimation](/reference/android/support/animation/SpringAnimation)\n - [SpringForce](/reference/android/support/animation/SpringForce)"]]