0

我正在从服务器下载图像并以位图格式存储在数组中,然后我初始化帧动画并希望从我之前制作的数组中对其进行动画处理,

我面临的问题是帧动画没有动画..

final AnimationDrawable frame_anim=new AnimationDrawable();
frame_anim.addFrame(new BitmapDrawable(context.getResources(),stadium_list.get(position)), 100);
frame_anim.addFrame(new BitmapDrawable(context.getResources(),sponser_list.get(position)), 100);
stadium_image.setBackgroundDrawable(frame_anim);
frame_anim.setVisible(true, true);
frame_anim.setOneShot(false);
notifyDataSetChanged();

stadium_image.postDelayed(new Runnable() {

    @Override
    public void run() {
        // TODO Auto-generated method stub
        frame_anim.start();
        Toast.makeText(context, "Animation", 1000).show();
    }
}, 3000);
4

1 回答 1

0

您的代码显示您错过了已编译为 AnimationDrawable 对象的背景。

AnimationDrawable frameAnimation = (AnimationDrawable) YOURIMAGEVIEW.getBackground();

动画可绘制

于 2014-04-15T11:10:56.187 回答