使用动画师为其某些属性设置动画后,如何将视图重置为原始状态? [英] How to reset view to original state after using animators to animates its some properties?

查看:230
本文介绍了使用动画师为其某些属性设置动画后,如何将视图重置为原始状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 动画器(ObjectAnimator) 为视图的几个属性 (缩放,旋转) 设置动画。

I am using animators (ObjectAnimator) to animate few properties (scale, rotate) of a view.

目标视图在将ObjectAnimators设置为正确时会动画。

Target view is animating properly when ObjectAnimators are set to it.

但是一段时间后,还需要查看原始位置 (重置)

But there is an added requirement to get view to the original position (reset) after a while.

我尝试 cancel()动画师,但是它只是取消动画并且不重置视图。

I tried to cancel() the animator but it only cancels the animation and doesn't reset the view.

可能的解决方案:创建另一个与初始动画制作器相反的动画制作器。

Possible solution : creating another animator that does just opposite of the initial animator.

还有其他重置方式吗?

推荐答案

请参见我想出了解决方案,因为在回收者视图中视图中的动画存在类似的问题,因此我不得不找到一种重置它们的方法:

See the solution I came up with as I had a similar issue with animations inside views in a recycler view, so I had to find a way to reset them:

尝试从中重置值Property Animator将在回收器视图中使用

Android O的好消息将更好地支持这些

Good news in Android O these will be better supported

这篇关于使用动画师为其某些属性设置动画后,如何将视图重置为原始状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆