[英]How to change the position of view after a translate animation using NineOldAndroids?
I tried searching around and found that you have to set a listener to change the actual position of the view when the animation ends. 我尝试四处搜索,发现必须设置一个侦听器才能在动画结束时更改视图的实际位置。 But the thing is, I don't know how I can get the end values from the ObjectAnimator I am using. 但问题是,我不知道如何从正在使用的ObjectAnimator中获取最终值。
Isn't there an easy way to do this aside from setting listeners to all of my Animators, there are like 9 of them. 除了为所有Animator设置侦听器之外,没有一种简便的方法可以做到这一点,其中有9个。 Something like a setFillAfter(true)
I always see that but I can't seem to find what Animator object uses it. 像setFillAfter(true)
类的东西我总能看到,但似乎找不到Animator对象使用它的东西。
It turns out you have to have an AnimatorListener attached to the Animators that will do this for you. 事实证明,您必须在Animators上附加一个AnimatorListener才能为您执行此操作。 But that is too much for me because I have multiple Animators. 但这对我来说太多了,因为我有多个动画师。 So what I did, I positioned them on the layout in what they would be after the end animation, then I made the Animator to animate from the start position to their end position. 因此,我做的是,将它们放置在布局上,使其处于结束动画之后的状态,然后使Animator从开始位置到结束位置进行动画处理。 That way I don't have to fret over the actual positions of the views 这样,我不必担心视图的实际位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.