我想实现的是,一个控件上面同事拥有两种或者两种以上的动画效果。比如说我给一个ImageView设置了一个移动的动画效果,但是我还想让这个控件在移动的同时进行旋转。这个该怎么做?跪求懂得大神指点
2条回答
- Kelley_cfy 2014-11-18 03:36关注
AnimationSet as;
Animation bs;
TranslateAnimation ta;
ScaleAnimation sa;
RotateAnimation ra;
AlphaAnimation aa;
ta=new TranslateAnimation(0f, 500, 0f, 550);
sa=new ScaleAnimation(1f, 0.5f, 1f, 0.5f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
ra=new RotateAnimation(0f, 1800f,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);ta.setDuration(2000); ta.setRepeatCount(-1); sa.setDuration(2000); sa.setRepeatCount(-1); ra.setRepeatCount(-1); ra.setDuration(2000); bs=AnimationUtils.loadAnimation(this, R.layout.animation); as.setDuration(2000); as.setRepeatCount(-1); as.addAnimation(sa); as.addAnimation(ra); as.addAnimation(ta); 然后用view.startAnimation(as)就行了,AnimationSet就是一系列的动作
解决 无用评论 打赏 举报
悬赏问题
- ¥15 运筹学中在线排序的时间在线排序的在线LPT算法
- ¥30 求一段fortran代码用IVF编译运行的结果
- ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
- ¥15 lammps拉伸应力应变曲线分析
- ¥15 C++ 头文件/宏冲突问题解决
- ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
- ¥50 安卓adb backup备份子用户应用数据失败
- ¥20 有人能用聚类分析帮我分析一下文本内容嘛
- ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
- ¥30 python代码,帮调试,帮帮忙吧