android ViewAnimation执行完无法隐藏控件?
黄舟
黄舟 2017-04-17 15:21:39
0
4
692

项目里给一个TextView设置放大和平移的动画,执行完以后,设置了View.GONE。发现布局中还是能看到。getVisibility()返回的是8,不可见。这是什么原因呢。

原因:设置了setFillAfter(true);,具体为什么不知道。
解决办法:

tv.clearAniamtion();
tv.invalidate();
     
     

参考:http://blog.csdn.net/nijiayy/article/details/40683639

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
Peter_Zhu

Reason: setFillAfter(true); is set, I don’t know the specific reason.
Solution:

tv.clearAniamtion();
tv.invalidate();
 
 

Reference: http://blog.csdn.net/nijiayy/article/details/40683639

黄舟

If you have code when you ask a question, it is best to post the main code
This way others can better handle your problem

阿神

Is the moving position wrong?

左手右手慢动作

ViewAnimation essentially does not change the properties of the control. You can follow the method you mentioned, clear and then invalidate after the animation ends; you can also use propertyAnimation directly to implement animation.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!