Home > Software design >  Can I finish an animation without the animating itself
Can I finish an animation without the animating itself

Time:03-03

If I have an animation like this

textView.animate().translationY(-translationY * 0.32f).scaleX(0.7f).scaleY(0.7f);

is it possible to directly "end" the animation so that the user won't see the movement of the textview but its final position will be the translated and shifted one?

I do not want to use another textview. Only some code pathes do not need the animation itself but the end position directly

CodePudding user response:

You can directly set the required properties on the View without starting an animation:

textView.setTranslationY(-translationY * 0.32f);
textView.setScaleX(0.7f);
textView.setScaleY(0.7f);

Or you can set the duration to a very small value:

textView.animate().translationY(-translationY *0.32f).scaleX(0.7f).scaleY(0.7f).setDuration(1);
  • Related