You could just use a TransitionDrawable instead :)

On Mon, Nov 16, 2009 at 10:43 PM, Digital Agua <reltubse...@gmail.com> wrote:
> I was wondering if someone has a good answer to this. I am looking for
> a better way to animate a background color transition from on color to
> the next.
>
> Currently, I have two views, vCurrentColor which lays on top of the
> vNextColor, in a FrameLayout. I then animate the alpha of the
> currentColorView to zero. At the end of the animation I swap the
> positions of the views and repeat the process. It is kludgey and slow
> and I am looking for an alternate method.
>
>        private void setAnimation(){
>                color_fade0 = AnimationUtils.loadAnimation
> (this,R.anim.fade_color_slow);
>        }
>
>        private void changeColorTo(int newColor){
>                vNextColor.setBackgroundColor(newColor);
>                useColorFade0 = false;
>                color_fade0.setAnimationListener(color_fade_listener);
>                vCurrentColor.startAnimation(color_fade0);
>        }
>
>        Animation.AnimationListener color_fade_listener = new
> Animation.AnimationListener() {
>                public void onAnimationEnd(Animation animation) {
>                        vColorContainer.bringChildToFront(vNextColor);
>                        LinearLayout swappyMcGee = vCurrentColor;
>                        vCurrentColor = vNextColor;
>                        vNextColor = swappyMcGee;
>                }
>                public void onAnimationStart(Animation animation) {}
>                public void onAnimationRepeat(Animation animation) {}
>        };
>
> Any help with this would be appreciated.
>
> Thanks,
> James
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

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

Reply via email to