I'm trying to do an Animation between different image resources. Therefor I'm using the frame animation.
listanimation.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/music_playing_indicator_1"
android:oneshot="false">
<item android:drawable="@drawable/animation_1" android:duration="500" />
<item android:drawable="@drawable/animation_2" android:duration="50" />
<item android:drawable="@drawable/animation_4" android:duration="50" />
<item android:drawable="@drawable/animation_5" android:duration="50" />
<item android:drawable="@drawable/animation_2" android:duration="80" />
<item android:drawable="@drawable/animation_1" android:duration="150" />
<item android:drawable="@drawable/animation_3" android:duration="600" />
<item android:drawable="@drawable/animation_2" android:duration="250" />
</animation-list>
animation_1 - 5.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<size
android:height="2dp"
android:width="2dp" />
<solid android:color="#ffffff" />
</shape>
I just adjust the height form 2dp to 4dp to 6dp to 8dp to 10dp.
animation_1 2dp
animation_2 4dp
animation_3 6dp and so on.
After I run the animation, of course I set the background of the imageview to my animation-list drawable.
ImageView img = (ImageView) getView().findViewById(R.id.Animation);
AnimationDrawable frameAnimation = (AnimationDrawable) img
.getBackground();
frameAnimation.start();
But here is the Problem the animation seems not to animation as it should. it's slow sometimes it's not animating at all.
If I do the same thing with real .png files. animation_1 -5.png with different heights It works Perfectly. I'm confused now. Is there any limitation of using shapes in animation-list?
The reason why I'm using the shapes its easier to target different devices with different screen sizes an so on.
I'm thankful for any help...
Cheers Alex