传一个开始位置的坐标,传一个结束位置的坐标,然后依次循环遍历,利用线程休眠达到效果
for (j = frommo; j < tomo; j++) {
runOnUiThread(new Runnable() {
public void run() {
btns[j + 1]
.setBackgroundResource(R.anim.peopleanim);
animationDrawable = (AnimationDrawable) btns[j + 1]
.getBackground();
btns[j + 1].setAlpha(0);
animationDrawable.setOneShot(true);
animationDrawable.stop();
animationDrawable.start();
// service.start();
// service.stop();
}
});
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}