放大动画

Nir*_*tel 6 animation android zoom

RotateAnimation用于图像.但我也希望用动画缩放图像.意味着我的图像旋转然后图像也缩放...

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

Kom*_*omi 12

在动画xml中,你可以像这样使用scale:

<scale
    android:pivotX="50%"
    android:pivotY="50%"
    android:fromXScale=".1"
    android:fromYScale=".1"
    android:toXScale="1.0"
    android:toYScale="1.0"
    android:duration="2000" />
Run Code Online (Sandbox Code Playgroud)

  • 谢谢Komi:我使用动态代码..就像 (2认同)

Des*_*tro 10

在缩放动画中称为缩放动画.

 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);
Run Code Online (Sandbox Code Playgroud)


Pas*_*sha 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();
Run Code Online (Sandbox Code Playgroud)

您应该根据需要更改参数.

  • 你应该玩属性(为动画设置正确的参数并不是很容易).并将`animSet`动画添加到你的`ImageView`(或你使用的其他`View`). (2认同)