我想实现的是,一个控件上面同事拥有两种或者两种以上的动画效果。比如说我给一个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 #MATLAB仿真#车辆换道路径规划
- ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
- ¥15 数据可视化Python
- ¥15 要给毕业设计添加扫码登录的功能!!有偿
- ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
- ¥15 微信公众号自制会员卡没有收款渠道啊
- ¥100 Jenkins自动化部署—悬赏100元
- ¥15 关于#python#的问题:求帮写python代码
- ¥20 MATLAB画图图形出现上下震荡的线条
- ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘