我想实现的是,一个控件上面同事拥有两种或者两种以上的动画效果。比如说我给一个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 素材场景中光线烘焙后灯光失效
- ¥15 请教一下各位,为什么我这个没有实现模拟点击
- ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 ubuntu子系统密码忘记
- ¥15 保护模式-系统加载-段寄存器