My layout transition is ignoring the duration I set in setDuration()
. 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)
.setDuration(50000);
mTransitioner.setAnimator(LayoutTransition.DISAPPEARING, disappearingAnim);
mLayout.setLayoutTransition(mTransitioner);
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.
It turns out I was laboring under a misconception about how LayoutTransition
s work. The correct way to add a duration is the following:
mTransitioner.setDuration(
LayoutTransition.DISAPPEARING, // Transition type
disappearingAnim, 1000L // duration in ms
);