In my menu I'm trying to implement a button that, when click, makes another button appear using an alpha animation.
final Animation animAlphaUp = new AlphaAnimation(0.0f, 1.0f);
animAlphaUp.setDuration(200);
ImageButton start_button = (ImageButton) findViewById(R.id.start_button);
ImageButton options_button = (ImageButton) findViewById(R.id.options_button);
final ImageButton mute_button = (ImageButton) findViewById(R.id.options_button);
options_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mute_button.startAnimation(animAlphaUp);
}
});
mute_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
but when the options button is clicked nothing happens. The animation works, i know this because if i write this:
options_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
options_button.startAnimation(animAlphaUp);
}
});
the animation works on the button that is clicked.
What am i doing wrong?
Thanks.
Try using your_button_name.startAnimation(your_animation_name); instead.
Worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With