Zoom in Animation

2019-02-13 17:19发布

I am using RotateAnimation for image. But I also want zoom on image with animation. Means when my image is rotate then image is also zooming...

How can I do zoom with rotate animation?

3条回答
Deceive 欺骗
2楼-- · 2019-02-13 18:00

I have one idea, hope it's help.

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();

You should change parameters as need your application.

查看更多
Juvenile、少年°
3楼-- · 2019-02-13 18:00

In the Zooming animation is called 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);
查看更多
相关推荐>>
4楼-- · 2019-02-13 18:08

In anim xml, you can work with scale like this:

<scale
    android:pivotX="50%"
    android:pivotY="50%"
    android:fromXScale=".1"
    android:fromYScale=".1"
    android:toXScale="1.0"
    android:toYScale="1.0"
    android:duration="2000" />
查看更多
登录 后发表回答