Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can I finish an animation without the animating itself

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

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);
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading