mscwd01 wrote:
> I having trouble understanding how to apply and then run an animation
> with a view though.
> 
> I create the animation:
> 
> Animation identityOverlayAnimationIn = new AlphaAnimation(0.0f, 1.0f);
>               identityOverlayAnimationIn.setDuration(5000);
>               identityOverlayAnimationIn = new TranslateAnimation(
>             Animation.RELATIVE_TO_SELF,
> -0.0f,Animation.RELATIVE_TO_SELF, 0.0f,
>             Animation.RELATIVE_TO_SELF,
> -1.0f,Animation.RELATIVE_TO_SELF, 0.0f
>         );

If you want multiple animations to occur simultaneously, you need to use
an AnimationSet. In the above code, you set identityOverlayAnimationIn
to be an AlphaAnimation, then replace it with a TranslateAnimation.

With a TranslateAnimation, you frequently will want to use an animation
listener, to get control when the animation completes. By default, a
TranslateAnimation will "snap back" to the original position when done,
but you can adjust settings on the animated View to change that (e.g.,
setVisibility(View.GONE)).

> Than apply it to the RelativeLayout:
> 
> theLayout.setAnimation(identityOverlayAnimationIn);
> 
> Then run it like this:
> 
> identityOverlayAnimationIn.start();

I tend to use theLayout.startAnimation(identityOverlayAnimationIn);

> But it doesn't seem to work...

Your TranslateAnimation has no duration, among other things.

Visit:

http://commonsware.com/AdvAndroid

and download the source code to my Advanced Android book. You will find
a couple of Animation sample projects.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to