AutonomousApps AutonomousApps - 6 months ago 34
Android Question

ObjectAnimator ignoring duration in LayoutTransition

My layout transition is ignoring the duration I set in

. No matter what value I set it to, it appears to be using the default. Here I've tried 50s, and it disappears after a few milliseconds.

Animator disappearingAnim = ObjectAnimator
.ofFloat(null, "alpha", 0f)

mTransitioner.setAnimator(LayoutTransition.DISAPPEARING, disappearingAnim);

The code snippet above should cause disappearing views to fade out over 50s, but instead they fade over ~300ms.

I've looked at this question and this question, but I have animator scale set to 1x in developer options.

Developer Options


It turns out I was laboring under a misconception about how LayoutTransitions work. The correct way to add a duration is the following:

    LayoutTransition.DISAPPEARING, // Transition type
    disappearingAnim, 1000L        // duration in ms