I was wondering why my animated gif is not displaying properly and whether anyone can suggest what I have done wrong.
here is the code :
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/star1" android:duration="500" />
<item android:drawable="@drawable/star2" android:duration="500" />
<item android:drawable="@drawable/star3" android:duration="500" />
<item android:drawable="@drawable/star4" android:duration="500" />
<item android:drawable="@drawable/star5" android:duration="500" />
<item android:drawable="@drawable/star6" android:duration="500" />
</animation-list>
I set the duration long so I can see what was going on and why it looked wrong ....
image view in layout xml of a dialog box
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
/>
here is the java to load it :
ImageView img = (ImageView) dialog.findViewById(R.id.image);
img.setBackgroundResource(R.drawable.star_animation);
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
frameAnimation.start();
The animation loads and works fine except 1 image in the sequence messes up ... here is a screen of the png :
star4.png appears to stretch the image and I don't know why.... anyone got an ideas... I have tried making the image same size as star1 with transparency but that also did not work....
I remade image star4.png with a larger transparent area.... this appears to have worked. I don't think it worked when I tried above as I didn't clean the project before running.
Cheers Guys