• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Animation for button does'nt working

sebasx

Lurker
Hello,

I try add animation for button, I try use own, xml file

<animation-list android:oneshot="false" xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/cat" android:duration="200" />
<item android:drawable="@drawable/catakt" android:duration="200" />
<item android:drawable="@drawable/cat" android:duration="200" />
<item android:drawable="@drawable/catakt" android:duration="200" />
<item android:drawable="@drawable/cat" android:duration="200" />
<item android:drawable="@drawable/catakt" android:duration="200" />
<item android:drawable="@drawable/cat" android:duration="200" />
<item android:drawable="@drawable/catakt" android:duration="200" />
<item android:drawable="@drawable/cat" android:duration="200" />
<item android:drawable="@drawable/catakt" android:duration="200" />
</animation-list>

saved as catanim.xml
and use as setBackgroundResource(R.drawable.catanim);

That doesn't work

I try also code like here

animation = new AnimationDrawable();
animation.addFrame(getResources().getDrawable(R.drawable.cat), 3000);
animation.addFrame(getResources().getDrawable(R.drawable.catakt), 3000);
animation.addFrame(getResources().getDrawable(R.drawable.cat), 3000);
animation.addFrame(getResources().getDrawable(R.drawable.catakt), 3000);
animation.addFrame(getResources().getDrawable(R.drawable.cat), 3000);
animation.addFrame(getResources().getDrawable(R.drawable.catakt), 3000);
animation.setOneShot(false);

animal1Button.setBackgroundDrawable(animation);
animation.setVisible(true, true);
animation.start();

And animation for button still doean't work on Emulator and Device (both with Android 2.1 / API 7)

Please help
 
Back
Top Bottom