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
matrix?
--~--~---------~--~----~------------~-------~--~----~



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. SDCard and SQLiteOpenHelper problem

Hello,

I need to be able to work with databases on the sdcard.

I've been using the following code snippet from the NotePad
application and works perfectly on the emulator without using the
sdcard.

private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context) {
super(context, "mydb.sqlite", null, 2);
}

When I include the path to the db as
 "/sdcard/application/mydb.sqlite"

the following error occurs
 10-29 09:57:04.798: ERROR/AndroidRuntime(200): Caused by:
java.lang.IllegalArgumentException: File /sdcard/application/
mydb.sqlite contains a path separator

The sdcard is properly emulated.
The path exists.

I've looked around but no obvious solution to me.

Any help greatly appreciated.

Cheers,
Wes

--~--~---------~--~----~------------~-------~--~----~

2. : How to stops the activity from getting restarted when mode changes from LandScape to Portrait or vice-versa

Given that the screen probably has to rerender the layout as a result
of the change in orientation, I really doubt that's the case.  I'm
also not sure why it would be a pressing issue, since the functions it
uses to do so are things you have to write anyway for normal app
operation.

If you want to force a particular layout each time, however, you can
specify that in the manifest file using android:screenOrientation for
that particular activity.

The screen doesn't flicker (at least in the emulator), but I have no
idea if it will still go through the lifecycle changes as a result.



--~--~---------~--~----~------------~-------~--~----~

3. activity doesn't seem to end, despite calling .finish()...

4. "Wiring" emulator services to PC's

5. Carrymobile 's HTC Dream/T-Mobile G1/Google Andriod leather case released

6. pop3

7. G1 Leather Case