KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a LinearLayout that I want to be able to show/hide by clicking on a "more details" link. I do this by calling moreDetailsSection.setVisibility(View.VISIBLE); or moreDetailsSection.setVisibility(View.GONE); to show/hide it. This works fine, but I wanted to add an animation that makes the layout fields slide in nicely, but this is only run the first time the field is made visible, if I hide it and show it again the field simply appears all of a sudden. Here is the animation code (moreDetailsSection is the Layout in question): AnimationSet set = new AnimationSet(true); Animation animation = new AlphaAnimation(0.0f, 1.0f); animation.setDuration(250); set.addAnimation(animation); animation = new TranslateAnimation( Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f ); animation.setDuration(150); set.addAnimation(animation); LayoutAnimationController controller = new LayoutAnimationController(set, 0.25f); moreDetailsSection.setLayoutAnimation(controller); Any advice on how to make this run EACH time I show the layout and not only the first time?
Tags (comma-separated)
Save Edits
Cancel