首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Android动画不重复

Android动画不重复
EN

Stack Overflow用户
提问于 2010-12-19 07:04:34
回答 23查看 98.4K关注 0票数 87

我正在尝试制作简单的动画,可以重复几次(或无限次)。

看起来android:repeatCount不工作了!

这是我来自/res/anim/first_animation.xml的动画资源:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false"
    android:repeatCount="infinite"
    >
    <scale
        android:interpolator="@android:anim/decelerate_interpolator"
        android:duration="500"
        android:fromXScale="1.0"
        android:fromYScale="1.0"
        android:toXScale="1.2"
        android:toYScale="1.2"
        android:pivotX="50%"
        android:pivotY="50%"
        android:fillAfter="false" />
    <scale
        android:interpolator="@android:anim/accelerate_interpolator"
        android:startOffset="500"
        android:duration="500"
        android:fromXScale="1.2"
        android:fromYScale="1.2"
        android:toXScale="1.0"
        android:toYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:fillAfter="false" />
</set>

首先,它应该在500ms内将图像从1.0缩放到1.2大小。

然后在500毫秒内将其缩减到1.0。

下面是我是如何使用它的:

代码语言:javascript
复制
Animation firstAnimation = AnimationUtils.loadAnimation(this, R.anim.first_animation);
imgView.startAnimation(firstAnimation);

它做一个循环,然后结束。

它先是放大,然后缩小,然后停止。

如何才能使此功能按预期工作?

EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4480652

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档