我的应用程序有一个用于初始应用程序加载的旋转轮。在 android 3.0 蜂窝中工作正常。但在 ICS 4.0 中它被打破了。它是一个简单的旋转轮动画。在 ICS 中,这个轮子围绕其圆周附近的一个点而不是中心点旋转。这给人一种像摇摆不定的轮子而不是一致的旋转轮子的视觉印象。这是代码
布局:
<ImageView
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/spinner_white_48"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
/>
spinner_animation.xml
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:duration="1200">
</rotate>
Java 文件(活动)
Animation rotateSpinner = AnimationUtils.loadAnimation(this,R.anim.spinner_animation);
rotateSpinner.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
});
findViewById(R.id.spinner).startAnimation(rotateSpinner);
注意:该应用程序甚至无法在 4.0.2(Samsung Galaxy)上启动。但是在 4.0.3 应用程序中显示这个扭曲的动画效果很好(Nexus S)。
任何帮助表示赞赏。提前致谢