I have an ImageView
which is animated via startAnimation()
to slide it into the screen. It is visible and enabled in the XML
. When I add a Handler
for a delay or an onClick
event, nothing happens. When I remove the startAnimation()
everything works fine. Except the animation of course.
Heres my code:
balloon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
view.setVisibility(View.GONE);
}
});
Animation dropDown =
AnimationUtils.loadAnimation(context, R.anim.balloon_slide_down);
dropDown.setStartOffset(1500);
balloon.startAnimation(dropDown);
Any ideas why that is? I'm quite frustrated by now...
Thanks,
Ron
Alright... I thought it was odd that the ÌmageView
should not be at the position it is shown. So I figured out that just the setVisibility()
is somehow not working.
I changed my code to the following and it works:
balloon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
((ViewGroup) balloon.getParent()).removeView(balloon);
}
});