java从固定点旋转图像视图
我想创建一个仪表图表,并从其起点旋转指示器 我正在努力做到这一点
但指示灯旋转方向不正确 我也试过旋转
RotateAnimation(
0f, 180f, Animation.RELATIVE_TO_PARENT, 0f, Animation.RELATIVE_TO_PARENT, 0f
).apply {
interpolator = LinearInterpolator()
duration = 5000
repeatCount = 0
imgGauge.startAnimation(this)
}
它没有以正确的方式旋转,也在recyclerView中,当动画结束时,它会重置为默认值
# 1 楼答案
将
Animation.RELATIVE_TO_PARENT
更改为Animation.RELATIVE_TO_SELF
并添加fillAfter = true
以防止imageView重置为默认值