Android xml中的旋转动画不';不要在中间旋转

Android xml中的旋转动画不';不要在中间旋转,android,android-ui,android-gui,Android,Android Ui,Android Gui,这是我用xml制作的动画,我用android:pivotX=“50%”尝试过,但仍然没有得到我想要的。旋转点是错误的。我希望绿线围绕屏幕中间旋转 <?xml version="1.0" encoding="utf-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:interpolator="@android:ani

这是我用xml制作的动画,我用android:pivotX=“50%”尝试过,但仍然没有得到我想要的。旋转点是错误的。我希望绿线围绕屏幕中间旋转

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="0" android:interpolator="@android:anim/linear_interpolator"
    android:toDegrees="360" android:pivotX="0%" android:pivotY="0%"
    android:repeatCount="5"
    android:duration="5000" android:startOffset="0" />

我想制作如下动画:
绿线应旋转,旋转点应位于屏幕中心。我如何才能做到这一点?

使用旋转图像,将轴心点设置为图像的中心

RotateAnimation anim = new RotateAnimation(0f, 350f, 15f, 15f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(700);

// Start animating the image
final ImageView splash = (ImageView) findViewById(R.id.splash);
splash.startAnimation(anim);

// Later.. stop the animation
splash.setAnimation(null);

目前尚不清楚您目前的症状是什么,但可能与此问题有关:@Lukap不应同时是
android:pivotX
android:pivotY
设置为
“50%”