Android 动画标签——set
作用:动画合集
文件目录:res/anim/my_set.xml
<?xml version="1.0" encoding="utf-8"?>
Java代码:
AnimationSet set = (AnimationSet ) AnimationUtils.loadAnimation(this,R.anim.my_set);
imageView.startAnimation(set);
纯代码使用:(AnimationSet)
RotateAnimation rotateAnimation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotateAnimation.setFillAfter(true);// 设置保持动画最后的状态
rotateAnimation.setDuration(3000);// 设置动画时间
rotateAnimation.setRepeatCount(-1);//设置重复次数
imageView.startAnimation(rotateAnimation);
TranslateAnimation translateAnimation = new TranslateAnimation(0, 0, 0, 800);
translateAnimation.setRepeatCount(-1);//设置重复次数
imageView.startAnimation(translateAnimation);
AnimationSet animationSet = new AnimationSet(true);
animationSet.addAnimation(rotateAnimation);
animationSet.addAnimation(translateAnimation);
imageView.startAnimation(animationSet);
也可以单个写,方法设置都一样。
更多相关文章
- Android 相机2之常用工具代码(预览方向、预览尺寸、全屏显示、分
- [置顶] Android防火墙+流量统计代码
- Android应用程序获取ROOT权限代码
- android 个人铃声设置代码
- android典型代码系列(九)------电话拦截
- Android里用代码设置View的相关属性
- Android自动测试代码
- Android Audio代码分析18 - setSampleRate函数