我正在制作一个程序,在同一个 ImageView 中显示图像的不同部分。但它应该在任何两个图像更改之间等待一段时间,大约 500 毫秒。像这样:
for(int i=1; i<=4;i++){
for(int j=1;j<=4;j++){
//code to refresh the image.
// wait for 500 milliseconds before resuming the normal iteration
}
}
我尝试使用以下代码:
for(int i=1; i<=4;i++){
for(int j=1;j<=4;j++){
//code to refresh the image.
Thread.sleep(500);
}
}
但这仅显示图像的最后一段,而不是逐段显示。顺便说一句,每个片段都保存为 pic1、pic2、pic3.. 等等(它们都是不同的图像)。我想要一个按以下顺序显示它们的解决方案:
- 图1
- 等待 500 毫秒
- 图2
- 等待 500 毫秒
- 图3
- ... 等等
万分感谢