Android examples for android.animation:AnimatorSet
expand View AnimatorSet
//package com.java2s; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.view.View; public class Main { public static AnimatorSet expandView(View view, int duration, boolean expand) { float start, end; if (expand) { start = 0f;/* w ww . j a v a 2s . c om*/ end = 1f; } else { start = 1f; end = 0f; } AnimatorSet animatorSet = new AnimatorSet(); ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, "scaleX", start, end); ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, "scaleY", start, end); animatorSet.play(animatorX).with(animatorY); animatorSet.setDuration(duration); return animatorSet; } }