EDIT:
Вы можете использовать Frame Animation: В res/drawable/myanim.xml
:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/pic_one" android:duration="50"/>
<item android:drawable="@drawable/pic_two" android:duration="50" />
<item android:drawable="@drawable/pic_three" android:duration="50" />
</animation-list>
Вы можете использовать эту анимацию в качестве простой вытяжки:
<ImageView android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/myanim"/>
Для запуска анимации вы делаете
AnimationDrawable backgroundDrawable = (AnimationDrawable) image.getDrawable();
backgroundDrawable.start();
Вы также можете использовать Value Animator. Я не тестировал это, но вы должны уметь добавить что-то подобное в обработчик onClick у вас:
int[] backgrounds = ...;//ids of the backgrounds for the button
ValueAnimator anim = ValueAnimator.ofInt(0, backgrounds.length);
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int i = (Integer) animation.getAnimatedValue();
int backgroundId = backgrounds[i];
yourButton.setBackgroundResource(backgroundId);
}
});
anim.setDuration(500); //0.5 seconds
anim.start();
вы что-то пробовали? например, играя с STYLES? – bofredo