android用rotate旋转文字,使用RotateAnimation在Android中围绕固定点旋转ImageView

我想在固定点周围连续旋转360度图像.我已经看过几个例子,例如:

RotateAnimation anim = new RotateAnimation(0, 360,150,150);

anim.setInterpolator(new LinearInterpolator());

anim.setRepeatCount(Animation.INFINITE);

anim.setDuration(2000);

[imageview].startAnimation(anim);

这会旋转图像,但它会在弧/圆形路径上旋转. IE浏览器.图像以圆周运动方式移动/旋转,但不会固定在它的起始位置.

我基本上想要的是模仿WindMill手臂的旋转.

有什么想法吗?

解决方法:

使用此代码

RotateAnimation rotateAnimation1 = new RotateAnimation(0, 360,

Animation.RELATIVE_TO_SELF, 0.5f,

Animation.RELATIVE_TO_SELF, 0.5f);

rotateAnimation1.setInterpolator(new LinearInterpolator());

rotateAnimation1.setDuration(duration);

rotateAnimation1.setRepeatCount(0);

img.startAnimation(rotateAnimation1);

这会将图像旋转到固定位置,即自身周围

标签:android,rotation,imageview,fixed-point,rotateanimation

来源: https://codeday.me/bug/20190531/1188304.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值