我从服务器下载图像并以位图格式存储在数组中, 然后我初始化帧动画,并希望从我之前制作的数组中动画它,
我面临的问题是帧动画不是动画..
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);
答案 0 :(得分:0)
您的代码显示您错过了获取已编译为AnimationDrawable对象的背景。
AnimationDrawable frameAnimation =(AnimationDrawable)YOURIMAGEVIEW.getBackground();