次の方法で共有


LayoutTransition Class

Definition

This class enables automatic animations on layout changes in ViewGroup objects.

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

Remarks

This class enables automatic animations on layout changes in ViewGroup objects. To enable transitions for a layout container, create a LayoutTransition object and set it on any ViewGroup by calling ViewGroup#setLayoutTransition(LayoutTransition). This will cause default animations to run whenever items are added to or removed from that container. To specify custom animations, use the LayoutTransition#setAnimator(int, Animator) setAnimator() method.

One of the core concepts of these transition animations is that there are two types of changes that cause the transition and four different animations that run because of those changes. The changes that trigger the transition are items being added to a container (referred to as an "appearing" transition) or removed from a container (also known as "disappearing"). Setting the visibility of views (between GONE and VISIBLE) will trigger the same add/remove logic. The animations that run due to those events are one that animates items being added, one that animates items being removed, and two that animate the other items in the container that change due to the add/remove occurrence. Users of the transition may want different animations for the changing items depending on whether they are changing due to an appearing or disappearing event, so there is one animation for each of these variations of the changing event. Most of the API of this class is concerned with setting up the basic properties of the animations used in these four situations, or with setting up custom animations for any or all of the four.

By default, the DISAPPEARING animation begins immediately, as does the CHANGE_APPEARING animation. The other animations begin after a delay that is set to the default duration of the animations. This behavior facilitates a sequence of animations in transitions as follows: when an item is being added to a layout, the other children of that container will move first (thus creating space for the new item), then the appearing animation will run to animate the item being added. Conversely, when an item is removed from a container, the animation to remove it will run first, then the animations of the other children in the layout will run (closing the gap created in the layout when the item was removed). If this default choreography behavior is not desired, the #setDuration(int, long) and #setStartDelay(int, long) of any or all of the animations can be changed as appropriate. Keep in mind, however, that if you start an APPEARING animation before a DISAPPEARING animation is completed, the DISAPPEARING animation stops, and any effects from the DISAPPEARING animation are reverted. If you instead start a DISAPPEARING animation before an APPEARING animation is completed, a similar set of effects occurs for the APPEARING animation.

The animations specified for the transition, both the defaults and any custom animations set on the transition object, are templates only. That is, these animations exist to hold the basic animation properties, such as the duration, start delay, and properties being animated. But the actual target object, as well as the start and end values for those properties, are set automatically in the process of setting up the transition each time it runs. Each of the animations is cloned from the original copy and the clone is then populated with the dynamic values of the target being animated (such as one of the items in a layout container that is moving as a result of the layout event) as well as the values that are changing (such as the position and size of that object). The actual values that are pushed to each animation depends on what properties are specified for the animation. For example, the default CHANGE_APPEARING animation animates the left, top, right, bottom, scrollX, and scrollY properties. Values for these properties are updated with the pre- and post-layout values when the transition begins. Custom animations will be similarly populated with the target and values being animated, assuming they use ObjectAnimator objects with property names that are known on the target object.

This class, and the associated XML flag for containers, animateLayoutChanges="true", provides a simple utility meant for automating changes in straightforward situations. Using LayoutTransition at multiple levels of a nested view hierarchy may not work due to the interrelationship of the various levels of layout. Also, a container that is being scrolled at the same time as items are being added or removed is probably not a good candidate for this utility, because the before/after locations calculated by LayoutTransition may not match the actual locations when the animations finish due to the container being scrolled as the animations are running. You can work around that particular issue by disabling the 'changing' animations by setting the CHANGE_APPEARING and CHANGE_DISAPPEARING animations to null, and setting the startDelay of the other animations appropriately.

Java documentation for android.animation.LayoutTransition.

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

LayoutTransition()

Constructs a LayoutTransition object.

LayoutTransition(IntPtr, JniHandleOwnership)

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

Fields

Appearing
Obsolete.

A flag indicating the animation that runs on those items that are appearing in the container.

ChangeAppearing
Obsolete.

A flag indicating the animation that runs on those items that are changing due to a new item appearing in the container.

ChangeDisappearing
Obsolete.

A flag indicating the animation that runs on those items that are changing due to an item disappearing from the container.

Changing
Obsolete.

A flag indicating the animation that runs on those items that are changing due to a layout change not caused by items being added to or removed from the container.

Disappearing
Obsolete.

A flag indicating the animation that runs on those items that are disappearing from the container.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsChangingLayout

Returns true if animations are running which animate layout-related properties.

IsRunning

Returns true if any of the animations in this transition are currently running.

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.

TransitionListeners

Gets the current list of listeners for layout changes.

Methods

AddChild(ViewGroup, View)

This method is called by ViewGroup when a child view is about to be added to the container.

AddTransitionListener(LayoutTransition+ITransitionListener)

Add a listener that will be called when the bounds of the view change due to layout processing.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DisableTransitionType(LayoutTransitionType)

Disables the specified transitionType for this LayoutTransition object.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EnableTransitionType(LayoutTransitionType)

Enables the specified transitionType for this LayoutTransition object.

Equals(Object)

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

(Inherited from Object)
GetAnimator(LayoutTransitionType)

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

GetDuration(LayoutTransitionType)

Gets the duration on one of the animation objects used by this transition.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetInterpolator(LayoutTransitionType)

Gets the interpolator on one of the animation objects used by this transition.

GetStagger(LayoutTransitionType)

Gets the length of time to delay between starting each animation during one of the change animations.

GetStartDelay(LayoutTransitionType)

Gets the start delay on one of the animation objects used by this transition.

HideChild(ViewGroup, View, ViewStates)

This method is called by ViewGroup when a child view is about to be hidden in container.

HideChild(ViewGroup, View)
Obsolete.

This member is deprecated.

IsTransitionTypeEnabled(LayoutTransitionType)

Returns whether the specified transitionType is enabled for this LayoutTransition 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)
RemoveChild(ViewGroup, View)

This method is called by ViewGroup when a child view is about to be removed from the container.

RemoveTransitionListener(LayoutTransition+ITransitionListener)

Remove a listener for layout changes.

SetAnimateParentHierarchy(Boolean)

This flag controls whether CHANGE_APPEARING or CHANGE_DISAPPEARING animations will cause the default changing animation to be run on the parent hierarchy as well.

SetAnimator(LayoutTransitionType, Animator)

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

SetDuration(Int64)

Sets the duration to be used by all animations of this transition object.

SetDuration(LayoutTransitionType, Int64)

Sets the duration on one of the animation objects used by this transition.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetInterpolator(LayoutTransitionType, ITimeInterpolator)

Sets the interpolator on one of the animation objects used by this transition.

SetStagger(LayoutTransitionType, Int64)

Sets the length of time to delay between starting each animation during one of the change animations.

SetStartDelay(LayoutTransitionType, Int64)

Sets the start delay on one of the animation objects used by this transition.

ShowChild(ViewGroup, View, ViewStates)

This method is called by ViewGroup when a child view is about to be made visible in the container.

ShowChild(ViewGroup, View)
Obsolete.

This member is deprecated.

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)

Events

EndTransition
StartTransition

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