I want to click the Button
it will show the TextView
is visible(perform slidedown animation), then want to click the button again it will perform another animation(slideup). after that don't need to show the TextView
.
How do i fix it?
please anyone have an answer to help me.
bclickss.setOnClickListener(new View.OnClickListener() {
boolean visible;
@Override
public void onClick(View v) {
if( visible = !visible) {
tv2.setVisibility(visible ? View.VISIBLE : View.GONE);
Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_down);
tv2.startAnimation(anim);
}
else {
Animation anim = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.slide_up);
tv2.startAnimation(anim);
tv2.setVisibility(View.GONE);
}
}
});