Android动画之Interpolator和AnimationSet(三)
来源:互联网 发布:一个矩阵的协方差矩阵 编辑:程序博客网 时间:2024/06/06 19:24
AnimationSet可以加入Animation,加入之后设置AnimationSet对加入的所有Animation都有效。
- AnimationSet anim=new AnimationSet(true);
- AlphaAnimation a=new AlphaAnimation(1,0);
- RotateAnimation ra=new RotateAnimation(0, 720, Animation.RELATIVE_TO_SELF,0.5f, Animation.RELATIVE_TO_SELF,0.5f);
- anim.addAnimation(a);
- anim.addAnimation(ra);
- anim.setDuration(3000);
- anim.setStartOffset(1000);
- iv.startAnimation(anim);
可以再xml文件中定义多个Animation,这样多个Animation可以一起运行
- <?xml version="1.0" encoding="utf-8"?>
- <set xmlns:android="http://schemas.android.com/apk/res/android"
- android:interpolator="@android:anim/accelerate_interpolator"
- android:shareInterpolator="true"
- >
- <alpha
- android:fromAlpha="1.0"
- android:toAlpha="0.0"
- android:startOffset="500"
- android:duration="3000"
- />
- <rotate
- android:fromDegrees="0"
- android:toDegrees="400"
- android:pivotX="50%"
- android:pivotY="50%"
- android:duration="3000"
- />
- </set>
Interpolator可以定义动画播放的速度
在xml文件中定义Interpolator
android:interpolator="@android:anim/accelerate_interpolator"
android:shareInterpolator="true"
这样所有的Animation共用一个Interpolator。
在代码中用代码设置如下
anim.setInterpolator(new AccelerateInterpolator());
在new一个AnimationSet中传入true则所有的Animation共用Interpolator。
0 0
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet(三)
- Android动画之Interpolator和AnimationSet
- android动画之Interpolator和AnimationSet
- Android动画之Interpolator和AnimationSet
- Android动画之Interpolator和AnimationSet
- android:interpolator animationSet属性
- android 动画AnimationSet 和 AnimatorSet
- android 动画AnimationSet 和 AnimatorSet
- android动画之Interpolator
- Android 动画之interpolator
- Android动画之Interpolator插补器
- Android动画之Interpolator插补器
- android动画 之Interpolator类
- ios 自定义UIAlertView
- 用Perl、Shell脚本基于Tomcat6开发cgi程序环境配置
- git学习--repo批量创建远端仓库----建立自己的android代码仓库
- IOS8 点击UIScollView上的按钮时无法滑动的解决方法
- 离线安装CDH 5
- Android动画之Interpolator和AnimationSet(三)
- 编辑框工具类 类名称:EditText_U
- 认识云计算
- Codeforces Round #222 (Div. 2)---A. Playing with Dice
- * 类描述:字符串工具类 类名称:String_U
- python核心模块之pickle和cPickle讲解
- JAVA第二课(运算符)
- 浅谈软件测试团队规范建设
- Cucumber-Lemonade Chiller