Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android- setDuration not Working? ObjectAnimator

I'm trying to move an ImageView down using ObjectAnimator. The setDuration() method doesn't seem to impact the duration of the animation. I can't set this animation in the XML as I want to play this dynamically.

    ObjectAnimator an= ObjectAnimator.ofFloat(img, View.TRANSLATION_Y, 0, 100);
    an.setDuration(5000);
    an.start();

Sorta off topic here but say I want to play more than one of those ObjectAnimation after each other, Is there a way to do that? I've looked at the Animator set but I wasn't sure if it would move the actual object like an Object Animator, instead of just appearing as so as in the TranslateAnimation.

Thanks in advance!

like image 910
Monty Avatar asked Jan 07 '23 22:01

Monty


1 Answers

Maybe you are testing on Samsung device? In this case, under developer options there is the option Animator duration scale that is set to off by default. If you switch to the normal value you can see the animations.

Hope this help.

like image 191
shaithana Avatar answered Jan 12 '23 01:01

shaithana