Search this blog

How to animate Specific Views in android

Animations must be applied and managed programmatically. Remember, costly
operations, such as animations, should be stopped if the application is paused for
some reason. The animation can resume when the application comes back into theforeground.
Let’s start with a simplest case: applying the fade_in animation to your title
TextView control, called TextViewTopTitle. All you need to do is retrieve an
instance of your TextView control in the onCreate() method of the
QuizSplashActivity class, load the animation resource into an Animation object,
and call the startAnimation() method of the TextView control:
TextView logo1 = (TextView) findViewById(;
Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);

When an animation must be stopped—for instance, in the onPause() method of the activity—you simply call the clearAnimation() method. For instance, the following
onPause() method demonstrates this for the corner logos:
protected void onPause() {
// Stop the animation
TextView logo1 = (TextView) findViewById(;
TextView logo2 = (TextView) findViewById(;
// ... stop other animations


Post a Comment