如何增加等待时间? [英] How to add wait time?

查看:134
本文介绍了如何增加等待时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有图片的背景同时改变。我必须一个一个地更改,每张图片后等待5秒钟,再更改另一个,

The backgrounds of all the pictures are changing at the same time. I have to change one by one, wait 5 seconds after each picture, change the other,

ImageView[] imajlar={img1,img2,img3,img4,img5,img6,img7,img8};

for (final ImageView resmi:imajlar) {
//resmi.startAnimation(fadeout);
   new CountDownTimer(16000, 1000) {
   @Override
   public void onTick(long millisUntilFinished) {
        resmi.setBackground(hediye);
        resmi.startAnimation(fadein);
        onPause();
   }

   @Override
   public void onFinish() {

   }
   }.start();


推荐答案

使用 Handler 为此。希望对您有所帮助。

Use Handler for this. I hope this helps you.

new Handler().postDelayed(new Runnable(){
       @Override
       public void run() {
           changeImage();
       }
}, 5000);

这篇关于如何增加等待时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆