gpt4 book ai didi

Android:动画完成后如何避免重启?

转载 作者:行者123 更新时间:2023-11-29 20:52:51 25 4
gpt4 key购买 nike

动画结束后图像会回到0,0怎么设置不回去?仍然停留在100,100

Animation am = new TranslateAnimation((float)0(), (float)100, (float)0,(float)100);

am.setDuration(5000);
am.setRepeatCount(0);
point.startAnimation(am);

最佳答案

使用 Animation.setFillAfter(true) 来保持最终的动画状态。

http://developer.android.com/reference/android/view/animation/Animation.html#setFillAfter(boolean)

If fillAfter is true, the transformation that this animation performed will persist when it is finished. Defaults to false if not set. Note that this applies to individual animations and when using an AnimationSet to chain animations.

Animation am = new TranslateAnimation((float)0(), (float)100, (float)0,(float)100);

am.setDuration(5000);
am.setFillAfter(true);
am.setRepeatCount(0);
point.startAnimation(am);

关于Android:动画完成后如何避免重启?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28655457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com