0

I want to run a code after a View object is totally INVISIBLE.

  1. If I use alpha animation, the View seems to not totally disappear on AnimationEnd. I even tried to create a new class (extends View) and override method onAnimatonEnd, but it didn't help.(See this link: android animation is not finished in onAnimationEnd)

  2. If I just call View.setVisibility(View.INVISIBLE), I can see that the View object is not totally INVISIBLE when the code starts to run.

Please help me!

Community
  • 1
  • 1
TOP
  • 2,574
  • 5
  • 35
  • 60

3 Answers3

0

Perhaps call view.setVisibility(View.GONE) in onAnimationEnd?. If you don't want the view to be gone completely how about setting the alpha to 0 in onAnimationEnd so view.setAlpha(0)

Andy Joyce
  • 2,802
  • 3
  • 15
  • 24
  • I tried to make the view **invisible** with Alpha animation. Or I tried view.setAlpha(0) without animation. Both of them didn't work – TOP Nov 11 '15 at 11:38
  • what about settings the view to gone? or is that something that you cant use? – Andy Joyce Nov 11 '15 at 11:39
0

Check 2nd answer by William (not accepted one) in How to handle visibility changes for a custom android view/widget. That way you can listen to visibility change of your view and then run your code.

human123
  • 295
  • 1
  • 9
0

you should try to set it INVISIBLE from the XML code, like this:

<View... android:visibility="gone"/>
or
<View... android:visibility="invisible"/>
Nirel
  • 1,855
  • 1
  • 15
  • 26