放大动画

问题描述 投票:0回答:4

我使用

RotateAnimation
作为图像。 但我也想用动画放大图像。 意味着当我的图像旋转时,图像也会缩放......

如何使用旋转动画进行缩放?

android animation zooming
4个回答
12
投票

在 anim xml 中,您可以像这样使用比例:

<scale
    android:pivotX="50%"
    android:pivotY="50%"
    android:fromXScale=".1"
    android:fromYScale=".1"
    android:toXScale="1.0"
    android:toYScale="1.0"
    android:duration="2000" />

12
投票

Zooming动画中称为Scale Animation。

 ScaleAnimation scal=new ScaleAnimation(0, 1f, 0, 1f, Animation.RELATIVE_TO_SELF, (float)0.5,Animation.RELATIVE_TO_SELF, (float)0.5);
    scal.setDuration(500);
    scal.setFillAfter(true);
    ((ImageView)findViewById(R.id.logo)).setAnimation(scal);

8
投票

我有一个想法,希望对你有帮助。

AnimationSet animSet = new AnimationSet(false);
RotateAnimation rotate = new RotateAnimation(0, 180);
ScaleAnimation zoom = new ScaleAnimation(0, 0, 1, 1);

animSet.addAnimation(rotate);
animSet.addAnimation(zoom);

animSet.start();

您应该根据应用程序的需要更改参数。


0
投票

[

  1. 在此输入图片描述

]1

enter code here
1000012844-01

© www.soinside.com 2019 - 2024. All rights reserved.