Only two sentences are repeated in nonsense;
Gone is really hidden;
The invisible is not visible but the location of the view is reserved;
Online repetition of these two sentences with examples, and do not observe the nature to make a distinction. See the source after the difference hope that the vast number of friends can learn from, the source code as follows:
/*Check If the GONE bit has changed*/ if((Changed & GONE)! = 0) {needglobalattributesupdate (false); requestlayout (); if(((Mviewflags & visibility_mask) = =GONE)) { if(Hasfocus ()) Clearfocus (); Clearaccessibilityfocus (); Destroydrawingcache (); if(mparentinstanceofView) { //GONE views NoOp invalidation, so invalidate the parent (View) mparent). Invalidate (True); } //Mark The view drawn to ensure that it gets invalidated properly the next//Time It is visible and gets invalidatedMprivateflags |=Pflag_drawn; } if(Mattachinfo! =NULL) {mattachinfo.mviewvisibilitychanged=true; } } /*Check If the VISIBLE bit has changed*/ if((Changed & INVISIBLE)! = 0) {needglobalattributesupdate (false); /** If This view was becoming invisible, set the drawn flag so that * the next invalidate () would Not being skipped. */Mprivateflags|=Pflag_drawn; if(((Mviewflags & visibility_mask) = =INVISIBLE)) { //root view becoming invisible shouldn ' t clear focus and accessibility focus if(Getrootview ()! = This) { if(Hasfocus ()) Clearfocus (); Clearaccessibilityfocus (); } } if(Mattachinfo! =NULL) {mattachinfo.mviewvisibilitychanged=true; } }
If both gone and invisible can achieve your results, then you should choose invisible. Because from the source view gone need to re-layout and notify the upper view to refresh, there are caches to empty the cache, from the view of the cost of change invisible to be more cost-effective, if your view is not very resource-intensive situation!!! You are also very welcome to say what you think .
The principles of gone and invisible for view in Android