Android动画之Interpolator和AnimationSet(三)
来源:互联网 发布:网络骂人的歌曲最火的 编辑:程序博客网 时间:2024/06/08 04:53
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类
- 山东省第二届ACM大学生程序设计竞赛(原题) D:Binomial Coeffcients
- com初始化
- 斐波那契数列的递归和非递归算法
- c++继承中的内存布局
- UVa 10820 Send a Table(欧拉函数)
- Android动画之Interpolator和AnimationSet(三)
- 数据库表分割技术浅析
- cuda向设备端传递多个一维数组,并在kernel中引用方法
- struts2文件下载
- 安卓Android之高仿微信聊天的界面
- Struts的一个简单起步
- 数据库设计原则
- [android secure] 数据抓包跟踪监控android数据包
- 12、MTU的概念,什么是路径MTU? MTU发现机制,TraceRoute(了解)