Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Right - there's a delay at both levels. When you're running an Animator in the context of a LayoutTransition, you want to set the duration and startDelay on the LayoutTransition object, not on the underlying Animator (because the transition object will supply its own values for these properties to the animators that it runs).</p> <p>The reason for this is that a LayoutTransition is generally going to be a sequence of animations that run on the objects inside a container. So, for example, if you want an object to 'appear' in a container, then the transition will first animate the other objects out of the way, then animate the new object into place. Imagine adding an item into the middle of a set of objects (as in the case you see in the ApiDemos apps); it first makes space, then fades the object in.</p> <p>In the case of the original code above, you want the appearing animation to run immediately, so you should set the transition startDelay for APPEARING to 0 (as you did in the answer above).</p> <p>Going the other way, DISAPPEARING animations by default have no startDelay, but CHANGE_DISAPPEARING animations have a startDelay equal to the duration of the DISAPPEARING animation, under the assumption that you first want to remove an item, then animate the other items in the container into their new places.</p> <p>Since these are assumptions that don't necessarily apply to every situation, there are duration/startDelay properties on LayoutTransition to control the behaviors according to how you need it to work in your specific cases.</p> <p>Note also that if you don't want to run one of the animation types, you should set that animation to null (see the documentation for LayoutTransition.setAnimator(int, Animator)). Setting it to your dummyAnimator will not have the same effect. For one thing, the default duration/startDelay values on the LayoutTransition will still apply, even if you supply custom Animators for these animations.</p> <p>Something else to be aware of: the underlying timing mechanism (for Android, but also for most other platforms I've ever worked on) is going to have some minimum resolution. So you you set a duration of '1', that may not result in that animation ending in 1ms. Instead, it will run for one frame, then on the next frame (generally the refresh rate of the device in a well-behaved application if the system is not bogged down) it will see that the animation should end.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload