我有一个在屏幕上旋转的图像。现在的问题是,我想在 10 秒后在屏幕上一次又一次地生成这个图像。我尝试了很多使用 for 循环。但它不起作用。我想在屏幕上一次又一次地生成相同的旋转图像。请帮忙。提前致谢。这是代码。
@Override
public void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
int draw_x = Math.round(System.currentTimeMillis()
% (this.getWidth() * 2));
int draw_y = Math.round(System.currentTimeMillis()
% (this.getHeight() * 2));
for (int i = 0; i < 10; i++) {
if (draw_x > this.getWidth())
draw_x = (this.getWidth() * (2)) - draw_x;
if (draw_y > this.getHeight())
draw_y = (this.getHeight() * (2)) - draw_y;
if (draw_x > this.getWidth())
draw_x = (this.getWidth() * (2)) - draw_x;
if (draw_y > this.getHeight())
draw_y = (this.getHeight() * (2)) - draw_y;
canvas.drawBitmap(eBall, draw_x, draw_y, null);
image.add(eBall);
float time = System.currentTimeMillis();
while ((time+50000)>System.currentTimeMillis());
i++;
Invalidate();
}
}