On your onCreate() method add something like this:
final Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
final View l = findViewById(R.id.main);
Animation a = AnimationUtils.loadAnimation(
YourActivity.this, android.R.anim.fade_out);
a.setDuration(200);
a.setAnimationListener(new AnimationListener() {
public void onAnimationEnd(Animation animation) {
// Do what ever you need, if not remove it.
}
public void onAnimationRepeat(Animation animation) {
// Do what ever you need, if not remove it.
}
public void onAnimationStart(Animation animation) {
// Do what ever you need, if not remove it.
}
});
l.startAnimation(a);
}
});
No comments:
Post a Comment