Animation of a View

by Eddified » Thu, 10 Sep 2009 04:54:40 GMT

Sponsored Links
 I understand that animating a View using startAnimation() with a
TranslateAnimation object really just applies a transform on the
canvas that is being drawn on. In my case, the problems with this are:
a) sometimes I need to call bringChildToFront() (for a different View)
on the ViewGroup during the animation, which messes up the animation
because it triggers a requestLayout on all children, which in turn re-
lays out the child being animated... which messes up the continuity of
the animation. Perhaps causing a layout on the child being animated
isn't supposed to mess up animations, but it seems to be in my case.
b) after the animation (using an AnimationListener), I need to re-
layout the child to the new location, which is fine in concept, but
again messes up the animation because for some reason the actual
drawing of the last frame of the animation hasn't finished by the time
onAnimationEnd() is called. This causes the animation to go awry at
the very end. What's happening in my case is if I layout the animated
view to its new location in onAnimationEnd, the last step of the
animation is being applied to the new layout, so the view looks like
it is jumping around the screen. I tried a handler with no delay, and
that didn't work either. Using a handler with a delayed message to
accomplish the new layout works but is such a hack that I worry it may
not work correctly on another piece of hardware.

I could accomplish the animation by taking out the TranslateAnimation
and instead do a manual animation, and in the manual one, change the
layout of the view gradually (instead of transforming the matrix of
the canvas) but that's a lot of work and error-prone.

Any ideas? Are there tools I can use (besides manual application of
Handler.sendMessageDelayed()) to accomplish an animation that actually
re-lays out the view on each iteration instead of altering the canvas

Animation of a View

by Eddified » Thu, 10 Sep 2009 05:09:36 GMT

 another problem:
c) if something changes and I need to reverse the animation from it's
current half-way state, without completing the animation and without
simply clearing it, I don't see any way to accomplish this using the
Animation classes.

Given these problems, what approach should I take?


Sponsored Links

Other Threads

1. RESTful application with Protobufs


I need some hints about how to design an Android app that uses
Protobufs and RESTful consumption from a remote provider. Note that
I'm a fairly unexperienced Java coder, so I need some beginner's
hints :-) Maybe there's some kind of tutorial that deals with exactly
that subject? Or even a framework?

Additionally: What could be the appropriate group to ask "server-side
questions", i. e. those about how to design the RESTful provider with
GoogleApp's Java IDE.

Thanks so much,


2. Android program for utilities .. ( help needed)

sorry guys for posting a question over here.. i am currently a student
who is having my final year project and i need serious help in android
as i am new to this program..

i need to do a program which enable us to enter a certain data such as
water bills.. amount of water used and charge per liter of water... i
need a program that will be able to display a screen with essential
data list which i could enter my data and after i hit the submit
button.. it will auto calculate the results for me and display a total
amount for me.. and in the other way round the data i entered will be
sent to a site link where admins are able to view what the user has
actually entered and check on it.. pls do guide me with.. i need some
references thanks


3. how to use a Cancel button to clear data in an edittext

4. Problem with the deployment of an application

5. Cannot download the sdk

6. Persistent external libraries across reboot

7. Fwd: View this page "Downloads"