首页 > 系统 > Android > 正文

Android开发简单实现摇动动画的方法

2019-10-22 18:24:40
字体:
来源:转载
供稿:网友

本文实例讲述了Android开发简单实现摇动动画的方法。分享给大家供大家参考,具体如下:

1、先创建shake.xml

<?xml version="1.0" encoding="utf-8"?><translate xmlns:android="http://schemas.android.com/apk/res/android"  android:duration="700"  android:fromXDelta="0.0"  android:interpolator="@anim/cycle"  android:toXDelta="15.0" />

2、创建cycle.xml

<?xml version="1.0" encoding="utf-8"?><cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"  android:cycles="4.0" />

3、使用方式

Animation animation = AnimationUtils.loadAnimation(this, R.anim.shake);animation.setDuration(1000);animation.setRepeatMode(Animation.INFINITE);iv.startAnimation(animation);

希望本文所述对大家Android程序设计有所帮助。


注:相关教程知识阅读请移步到Android开发频道。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表