?效果图:
?放大1.5倍
/*
* view放大
* */
public static void startAnim(View view) {
final AnimatorSet animatorSet = new AnimatorSet();
view.setPivotX(view.getWidth() / 2);
view.setPivotY(view.getHeight() / 2);
animatorSet.playTogether(
ObjectAnimator.ofFloat(view, "scaleX", 1, 1.5f).setDuration(100),
ObjectAnimator.ofFloat(view, "scaleY", 1, 1.5f).setDuration(100));
animatorSet.start();
}
?复原
/*
* view复原
* */
public static void closeAnim(View view) {
final AnimatorSet animatorSet = new AnimatorSet();
view.setPivotX(view.getWidth() / 2);
view.setPivotY(view.getHeight() / 2);
animatorSet.playTogether(
ObjectAnimator.ofFloat(view, "scaleX", 1, 1f).setDuration(100),
ObjectAnimator.ofFloat(view, "scaleY", 1, 1f).setDuration(100));
animatorSet.start();
}
|