I am looking for a good answer to this as well.
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 a more better way to do this would be appreciated.
Thanks,
James
On Nov 6, 2:29 am, Ferran Garriga Ollé <[email protected]> wrote:
> Hi!
>
> As I know, there are not any color animation feature in android? How
> can I animate the background color of a view (for example?)
>
> Thank you.
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en