Created
March 15, 2013 10:54
-
-
Save kyleclegg/5169005 to your computer and use it in GitHub Desktop.
Helper methods to show and hide Android layouts
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
// Helper method to animate the showing of a view | |
private void showLayout (final LinearLayout theLayout) { | |
AlphaAnimation fade_in = new AlphaAnimation(0.0f, 1.0f); | |
fade_in.setDuration(500); | |
fade_in.setAnimationListener(new AnimationListener() { | |
public void onAnimationStart(Animation arg0) { | |
} | |
public void onAnimationRepeat(Animation arg0) { | |
} | |
public void onAnimationEnd(Animation arg0) { | |
theLayout.setVisibility(View.VISIBLE); | |
} | |
}); | |
theLayout.startAnimation(fade_in); | |
} | |
// Helper method to animate the hiding of a view | |
private void hideLayout (final LinearLayout theLayout) { | |
AlphaAnimation fade_out = new AlphaAnimation(1.0f, 0.0f); | |
fade_out.setDuration(500); | |
fade_out.setAnimationListener(new AnimationListener() { | |
public void onAnimationStart(Animation arg0) { | |
} | |
public void onAnimationRepeat(Animation arg0) { | |
} | |
public void onAnimationEnd(Animation arg0) { | |
theLayout.setVisibility(View.GONE); | |
} | |
}); | |
theLayout.startAnimation(fade_out); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment