Share via


LayoutTransition.SetAnimator(LayoutTransitionType, Animator) Method

Definition

Sets the animation used during one of the transition types that may run.

[Android.Runtime.Register("setAnimator", "(ILandroid/animation/Animator;)V", "GetSetAnimator_ILandroid_animation_Animator_Handler")]
public virtual void SetAnimator (Android.Animation.LayoutTransitionType transitionType, Android.Animation.Animator? animator);
[<Android.Runtime.Register("setAnimator", "(ILandroid/animation/Animator;)V", "GetSetAnimator_ILandroid_animation_Animator_Handler")>]
abstract member SetAnimator : Android.Animation.LayoutTransitionType * Android.Animation.Animator -> unit
override this.SetAnimator : Android.Animation.LayoutTransitionType * Android.Animation.Animator -> unit

Parameters

transitionType
LayoutTransitionType

One of #CHANGE_APPEARING, #CHANGE_DISAPPEARING, #CHANGING, #APPEARING, or #DISAPPEARING, which determines the animation whose animator is being set.

animator
Animator

The animation being assigned. A value of null means that no animation will be run for the specified transitionType.

Attributes

Remarks

Sets the animation used during one of the transition types that may run. Any Animator object can be used, but to be most useful in the context of layout transitions, the animation should either be a ObjectAnimator or a AnimatorSet of animations including PropertyAnimators. Also, these ObjectAnimator objects should be able to get and set values on their target objects automatically. For example, a ObjectAnimator that animates the property "left" is able to set and get the left property from the View objects being animated by the layout transition. The transition works by setting target objects and properties dynamically, according to the pre- and post-layoout values of those objects, so having animations that can handle those properties appropriately will work best for custom animation. The dynamic setting of values is only the case for the CHANGE animations; the APPEARING and DISAPPEARING animations are simply run with the values they have.

It is also worth noting that any and all animations (and their underlying PropertyValuesHolder objects) will have their start and end values set according to the pre- and post-layout values. So, for example, a custom animation on "alpha" as the CHANGE_APPEARING animation will inherit the real value of alpha on the target object (presumably 1) as its starting and ending value when the animation begins. Animations which need to use values at the beginning and end that may not match the values queried when the transition begins may need to use a different mechanism than a standard ObjectAnimator object.

Java documentation for android.animation.LayoutTransition.setAnimator(int, android.animation.Animator).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to