android - 如何使用九个旧的 androids 动画创建 ImageView 脉冲效果

标签 android android-animation android-imageview

我想知道如何使用九个 olad androids 框架动画创建脉冲效果。

为了更好地理解,假设您有一个 ImageView 并希望有一个“脉冲”效果,例如 将图像缩小一点,然后恢复到原始大小,缩放将居中。

为了向后兼容,我使用了九个 olad android。

欢迎任何其他选择。

谢谢。

最佳答案

R.anim.pulse:

<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromXScale="1"
    android:fromYScale="1"
    android:pivotX="50%"
    android:pivotY="50%"
    android:repeatCount="1"
    android:repeatMode="reverse"
    android:toXScale="0.5"
    android:toYScale="0.5" />
ImageView imageView = (ImageView) findViewById(R.id.image);
Animation pulse = AnimationUtils.loadAnimation(this, R.anim.pulse);
imageView.startAnimation(pulse);

关于android - 如何使用九个旧的 androids 动画创建 ImageView 脉冲效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14216798/

相关文章:

Android:如何计算dp?

android - 跟踪 Android 手机的电池高效方式

android - 在协调器布局中首先隐藏中间 View

android - 设置折叠工具栏中 TextView 和 ImageView 的对比度颜色

android - 如何拍照显示在 `ImageView`中并保存图片?

java - 将 USB 串行数据解析为可用变量

java - Android View 或 Activity ?

java.lang.ClassCastException : android. support.transition.Fade 无法转换为 android.transition.Transition?

android - ImageView 周围的进度或动画圈

android - 如何计算ScrollView中ImageView的触摸位置,考虑缩放因素?