В приложении для Android я применяю программно анимацию вращения к объекту с возможностью рисования:
Animation rotation = AnimationUtils.loadAnimation(this, R.animator.rotate);
rotation.setRepeatCount(Animation.INFINITE);
progressDialog.findViewById(R.id.progress).startAnimation(rotation);
Это отлично работает в Android 2.3, но не работает в 4.0. Выделенный не анимирован в 4.0. Что может быть проблемой здесь?
EDIT Вот мой файл rotate.xml
:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="2000"
android:repeatCount="-1"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
Я переместил код непосредственно перед вызовом метода show
контейнера и теперь он работает как в версиях 2.3, так и 4.0:
Animation rotation = AnimationUtils.loadAnimation(MainView.this, R.animator.rotate);
progressDialog.findViewById(R.id.progress).startAnimation(rotation);
progressDialog.show();