Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

弹窗的Animator动画属性复原问题 #509

Open
developerzjy opened this issue Apr 25, 2024 · 1 comment
Open

弹窗的Animator动画属性复原问题 #509

developerzjy opened this issue Apr 25, 2024 · 1 comment

Comments

@developerzjy
Copy link

使用onCreateDismissAnimator执行缩放平移消失动画后,再次调用showPopupWindow()显示弹窗,此时显示的是上次dismiss属性动画结束后的状态(缩放+平移后的状态),有自动恢复属性的方法吗。

我的需求是:弹窗展示的时候正常弹出,不需要任何动画,关闭弹窗的时候弹窗执行一个缩放平移动画到界面上的一个小button的位置,点击button的时候再次显示弹窗,显示弹窗不需要动画。

想到的解决办法有一些:
1.每次显示弹窗都新创建一个弹窗,不再复用旧弹窗
2.使用onCreateShowAnimator实现一个对应的显示弹窗动画

请问有更好的解决办法吗

@developerzjy developerzjy changed the title 弹窗的Animator动画问题 弹窗的Animator动画属性复原问题 Apr 26, 2024
@razerdp
Copy link
Owner

razerdp commented Apr 29, 2024

animator本身就会改变view属性,建议Animatorlistener,在start中记录初始属性,结束后恢复。
如果想更简单,建议用valueanimator,因为所有的动画属性都可以视为0%~100%的过程,恢复初始值就只需要设置回0%即可。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants