Android 为什么他的影像不能旋转?
我正在尝试在图像视图的中心旋转图像视图。当我点击图像时,它不会旋转。有什么原因吗Android 为什么他的影像不能旋转?,android,animation,Android,Animation,我正在尝试在图像视图的中心旋转图像视图。当我点击图像时,它不会旋转。有什么原因吗 refreshResults.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { RotateAnimation anim = new RotateAnimation(0.0f, 360.0f, Animation.RE
refreshResults.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RotateAnimation anim = new RotateAnimation(0.0f, 360.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
//how to start it.
refreshResults.startAnimation(anim);
}
});
试试这个,它对我有用
RotateAnimation myAnim = new RotateAnimation(0, 45, Animation.RELATIVE_TO_SELF,
0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
myAnim .setInterpolator(new LinearInterpolator());
myAnim .setDuration(500);
myAnim .setFillEnabled(true);
myAnim .setFillAfter(true);
image.startAnimation(myAnim )
旋转非常慢。myAnim.setDuration(100);其持续时间以毫秒为单位,您可以根据需要进行设置。谢谢。但是,请不要要求别人接受你的答案。如果它解决了你的问题,那么你有责任接受答案。谢谢。你应该切换到新的动画api,它是什么?比如
refreshResults.animate().rotation(360.start()代码>