我正在模拟帧动画;我有这一切工作备用一个问题。我有一个 for 循环,在每次迭代中,它都会在延迟后更改 ImageView 的图像。
for(int i = 1; i <13; i++){
if (stop== false){
String imgName = "b"+ Integer.toString(i);
id = getResources().getIdentifier(imgName, "drawable", getPackageName());
Handler handlerTimer = new Handler();
handlerTimer.postDelayed(new Runnable(){
public void run() {
view.setImageDrawable((getResources().getDrawable(id)));
}}, 300);
}
}
问题是 run() 不会在每次迭代时刷新。它只工作一次。
如何刷新或创建新的 run()?
我愿意接受任何其他方式来做到这一点。
任何意见,将不胜感激。