Sdílet prostřednictvím


AnimatorSet.Builder Class

Definition

The Builder object is a utility class to facilitate adding animations to a AnimatorSet along with the relationships between the various animations.

[Android.Runtime.Register("android/animation/AnimatorSet$Builder", DoNotGenerateAcw=true)]
public class AnimatorSet.Builder : Java.Lang.Object
[<Android.Runtime.Register("android/animation/AnimatorSet$Builder", DoNotGenerateAcw=true)>]
type AnimatorSet.Builder = class
    inherit Object
Inheritance
AnimatorSet.Builder
Attributes

Remarks

The Builder object is a utility class to facilitate adding animations to a AnimatorSet along with the relationships between the various animations. The intention of the Builder methods, along with the AnimatorSet#play(Animator) play() method of AnimatorSet is to make it possible to express the dependency relationships of animations in a natural way. Developers can also use the AnimatorSet#playTogether(Animator[]) playTogether() and AnimatorSet#playSequentially(Animator[]) playSequentially() methods if these suit the need, but it might be easier in some situations to express the AnimatorSet of animations in pairs. <p/>

The Builder object cannot be constructed directly, but is rather constructed internally via a call to AnimatorSet#play(Animator).

<p/>

For example, this sets up a AnimatorSet to play anim1 and anim2 at the same time, anim3 to play when anim2 finishes, and anim4 to play when anim3 finishes:

AnimatorSet s = new AnimatorSet();
                s.play(anim1).with(anim2);
                s.play(anim2).before(anim3);
                s.play(anim4).after(anim3);

<p/>

Note in the example that both Builder#before(Animator) and Builder#after(Animator) are used. These are just different ways of expressing the same relationship and are provided to make it easier to say things in a way that is more natural, depending on the situation.

<p/>

It is possible to make several calls into the same Builder object to express multiple relationships. However, note that it is only the animation passed into the initial AnimatorSet#play(Animator) method that is the dependency in any of the successive calls to the Builder object. For example, the following code starts both anim2 and anim3 when anim1 ends; there is no direct dependency relationship between anim2 and anim3:

AnimatorSet s = new AnimatorSet();
              s.play(anim1).before(anim2).before(anim3);

If the desired result is to play anim1 then anim2 then anim3, this code expresses the relationship correctly:</p>

AnimatorSet s = new AnimatorSet();
              s.play(anim1).before(anim2);
              s.play(anim2).before(anim3);

<p/>

Note that it is possible to express relationships that cannot be resolved and will not result in sensible results. For example, play(anim1).after(anim1) makes no sense. In general, circular dependencies like this one (or more indirect ones where a depends on b, which depends on c, which depends on a) should be avoided. Only create AnimatorSets that can boil down to a simple, one-way relationship of animations starting with, before, and after other, different, animations.

Java documentation for android.animation.AnimatorSet.Builder.

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.

Constructors

AnimatorSet.Builder(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

After(Animator)

Sets up the given animation to play when the animation supplied in the Play(Animator) call that created this Builder object to start when the animation supplied in this method call ends.

After(Int64)

Sets up the animation supplied in the Play(Animator) call that created this Builder object to play when the given amount of time elapses.

Before(Animator)

Sets up the given animation to play when the animation supplied in the Play(Animator) call that created this Builder object ends.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
With(Animator)

Sets up the given animation to play at the same time as the animation supplied in the Play(Animator) call that created this Builder object.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to