View setAnimation之后再setVisibility不起作用

来源:互联网 发布:oracle索引优化 工具 编辑:程序博客网 时间:2024/04/28 08:58

前提是你的Animation设置了这样一个属性:

 final Animation animation;animation.setFillAfter(true);

原因:

      All the animations (before android 3.0) are actually applied to a bitmap which is a snapshot of your view instead of on your original view. When you are setting the fill after to true this actually means that the bitmap will continue to be displayed on the screen instead of your view. This is the reason why the visibility won't change upon using setVisibility and also the reason why your view will not be receiving touch events in its new (rotated) bounds.

解决方案:

1、将setFillAfter设置为false,或者不设置(默认是false)

2、在你要做动画的View外部嵌套一个View

0 0
原创粉丝点击