简体   繁体   English

恢复进度栏中的倒数计时

[英]Resume countdown in progress bar

I have a progress bar that counts backwards. 我有一个倒数的进度条。 When show value 0 stop The countdown will be stopped. 显示值0停止时倒数停止。 In my qestion how do resume countdown in progress bar. 在我的问题中,如何在进度栏中恢复倒数计时。 This code show progress bar with countdown. 此代码显示带有倒计时的进度条。

new Thread(new Runnable() {

        @Override
        public void run() {
            progressBar.setMax(progressStatus);


            while (progressStatus > 0) {
                progressStatus -= 1;
                handler.post(new Runnable() {
                    @Override
                    public void run() {
                        progressBar.setProgress(progressStatus);
                        secondTimeTextView.setText(String.valueOf(progressStatus));
                    }
                });
                try {
                    Thread.sleep(1000);

                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }


        }
    }).start();  

If i understand it correctly this is what you want. 如果我正确理解,这就是您想要的。

How can I reset the Progressbar? 如何重置进度栏?

ProgressBar.setProgress(0)

Just set your Progress manually from 1..100 只需从1..100手动设置进度

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM