Last active
October 20, 2016 02:28
-
-
Save xxxzhi/7243697 to your computer and use it in GitHub Desktop.
use handler to deal with the invalid when setVisibility(View.GONE). At most time ,if the view is under use,setVisibility will be useless.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Message.obtain(handler,new Runnable() { | |
@Override | |
public void run() { | |
System.out.println("gone"); | |
viewGroup.getChildAt(i).clearAnimation(); // this is very imporant! clear animation | |
for(int i=0;i!=viewGroup.getChildCount();++i){ | |
if(viewGroup.getChildAt(i).getId() == id){ | |
viewGroup.getChildAt(i).setVisibility(View.VISIBLE); | |
}else{ | |
viewGroup.getChildAt(i).setVisibility(View.GONE); | |
} | |
} | |
} | |
}).sendToTarget(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment