Android Setvisibility (View.gone) Invalid problem and cause analysis

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.