0

I have problem with setting text between animations (fade out text then change it and fade in) using NineOldAndroids library. I have tried to set it like this:

ObjectAnimator.ofFloat(TextView, "alpha", 1, 0.5f, 0).setDuration(3000).start();
TextView.setText("Text");
ObjectAnimator.ofFloat(TextView, "alpha", 0, 0.5f, 1).setDuration(3000).start();

But it seems to change text and animate only second part (fade out). I have tried to use .setStartDelay(ms) and AnimatorSetBuilder, but no effects.

Stramek
  • 305
  • 1
  • 3
  • 14

1 Answers1

1

that's because you set 2 conflicting animations on the same variable at the same time. the animation starts as soon as you call it.

you probably wish to have one animation after another , right?

if so, you should use something else, for example set a listener or set when to start the second animation(not recommended), or use AnimatorSet (with "playSequentially"). i'm sure there are even other examples.

android developer
  • 114,585
  • 152
  • 739
  • 1,270