build ScaleAnimation - Android android.view.animation

Android examples for android.view.animation:Scale Animation

Description

build ScaleAnimation

Demo Code

import android.content.Context;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import android.view.animation.ScaleAnimation;

public class Main {

  public static AnimationSet buildAnimBoxClick(Context context) {
    final ScaleAnimation scale = new ScaleAnimation(0.5f, 1.3f, 0.5f, 1.3f, Animation.RELATIVE_TO_SELF, 0.5f,
        Animation.RELATIVE_TO_SELF, 0.5f);
    AlphaAnimation alpha = new AlphaAnimation(0.5f, 1.0f);
    AnimationSet mBoxAnimClick = new AnimationSet(true);
    mBoxAnimClick.addAnimation(scale);/*from   w w  w.j  av a  2 s. c om*/
    mBoxAnimClick.addAnimation(alpha);
    mBoxAnimClick.setDuration(100);
    return mBoxAnimClick;
  }

}

Related Tutorials