This is most likely due to the setting of animation and the Call of Setfillafter (true), which causes setvisibility to be invalid and only needs to be called clearanimation () method or remove the Setfillafter (true) statement.
The experiment proves that it is possible to call setanimation (null) as long as the mcurrentanimation of view is set to null before Setvisibility. From the source code to see Setfillafter false will also indirectly lead to call Clearanimation, and clearanimation here setvisibility valid reason is also set mcurrentanimation to null.
Setfillafter to False causes clearanimation indirectly:
The preliminary analysis that mcurrentanimation invalidates gone is probably the result of the following code:
In the Dispatchdraw view, although not visible, because it is | | will also cause Drawchild to be called. And the Drawchild code is as follows:
/** * Draw One child of this View Group. This method was responsible for getting * the canvas in the right state . This includes clipping, translating so * the child's scrolled origin is at 0, 0, and applying any animation * Transformations. * * @param canvas the canvas on which to draw the child * @param child who to draw * @param drawingtime the TI Me at which draw is occurring * @return True if a invalidate () was issued */ protected Boolean drawchild (Ca Nvas Canvas, View child, Long Drawingtime) { return Child.draw (canvas, this, drawingtime); }
Transferred from: http://www.cnblogs.com/albert1017/p/4724435.html
Android Setvisibility (View.gone) Invalid problem and cause analysis (GO)