Android Frame-by-Frame Animation of Problem on Elements in CursorAdapter

I'm having trouble applying animation in a view. I am trying to load the animation inside the CursorAdapter constructor, so I can install it later by assigning it to specific children in the list.

In the constructor, I have:

shineAnimation = AnimationUtils.loadAnimation(ctx, R.anim.news_list_item_shine); 

animation is in the res / anim directory

 <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="true"> <item android:drawable="@drawable/shine1" android:duration="200" /> <item android:drawable="@drawable/shine2" android:duration="200" /> <item android:drawable="@drawable/shine3" android:duration="200" /> <item android:drawable="@drawable/shine4" android:duration="200" /> <item android:drawable="@drawable/shine5" android:duration="200" /> </animation-list> 

I get an exception: Unknown animation name: animation list

Help would be greatly appreciated

Thanks S

+7
java android animation
source share
1 answer

I don’t think you are loading AnimationDrawables through AnimationUtils . AnimationDrawable more Drawable more than Animation . Try this sample code from the SDK manual.

  ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image); rocketImage.setBackgroundResource(R.anim.rocket_thrust); rocketAnimation = (AnimationDrawable) rocketImage.getBackground(); 
+2
source share

All Articles