Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 07:38:05 GMT

Sponsored Links

I'm using a TranslateAnimation to slide a ViewGroup in and out of
screen. However after the animation slides the view out, the
transparent view is still 'clickable' in the same place. I used
setFillAfter to TRUE thinking that the animation would 'stick' but I
can't seem to get the view out of my 'face'.

Any way to do this without setting up an animation completion handler
and then hide the view explicitly?

Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 08:21:16 GMT


Thanks Romain - I did this (and the completion listener) neither of
these work. Basically the 'AbsoluteLayout' ViewGroup slides out of the
screen but then when you tap on the are where that view once was, the
old buttons apparently still get tapped (eventhough completely
invisible). If I've 'translated' a view, shouldn't it stay where it is
and not get the kind of focus/clicks it's getting right now? I tried
setEnabled(false), setVisibility(View.GONE) -- nothing seems to work.
The 'invisible' view still gets touch events and buttons are being
pressed from the view that got slid away.

Am I doing something wrong?

Sponsored Links

Animation on a view doesn't 'stick' in reality

by fg1921 » Fri, 10 Apr 2009 08:33:39 GMT

 Okay I've figured it out. I would personally consider this a bug but
not sure if this is how it's meant to be.

Basically in onAnimationEnd I had to loop over all children inside the
viewgroup (and children of children) and set their visibility to GONE/
INVISIBLE and the buttons stopped getting touch events after animation
ended. And then onAnimationStart I had to set their visibility back to

Shouldn't setting visibility/focusability/enabled state etc on the
parent ViewGroup apply these down to its children as well (especially
the visibility part). Since the parent view became invisible, which is
fine, but the children view didn't (well internally) and thus were
intercepting Touch events eventhough the view as a whole was not

Other Threads

1. Quick Contacts popup

I can see a new Quick Contacts popup in Android 2.0. How can I use it
in my application? Can't find any samples.



2. Manage the Wifi connection from an applicacion


 I have some troubles connecting to a wireless network. I enable Wifi,
start the scan, and when it is ready I search for the network I am
finding. When I have found it, I create a configuration with every
parameter and it goes properly but when I try to enable it (disabling
the others), it fails.

Maybe I have forgeting anything? Any example I could follow?



3. Wifi does not automatically connect after boot

4. How to get all the log from phone reboot to IDLE

5. Problem download source code in linux (ubuntu 8.04)

6. AlertDialog setSingleChoiceItems

7. Possible to rescan sd-card with Media Scanner?