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

查看:105
本文介绍了如何重置进度栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚制作了一个Countdowntimer和一个Progressbar:

I just made a Countdowntimer and a Progressbar :

public void button1_onClick (View view) {
mCountDownTimer=new CountDownTimer(10000,1000) {

    @Override
    public void onTick(long millisUntilFinished) {
        Log.v("Log_tag", "Tick of Progress"+ i+ millisUntilFinished);
        i++;
        mProgressBar.setProgress(i);

    }

    @Override
    public void onFinish() {
        i++;
        mProgressBar.setProgress(i);
        game_end();
    }
};

 mCountDownTimer.start();
}
 public void button2_reset_onClick (View view) {
   mProgressBar.setProgress(0); }

它也可以正常工作,但是当我第二次尝试启动它时,我没有看到动画吗?它一直计数到10点,但我在进度条上看不到它.如何正确重置进度条?我已经尽力使我= 0,但没有帮助

It is also working but when I try to start it a second time I get no animation ? It counts until 10 but I cannot see it on the Progressbar... How can I reset the Progressbar properly ? I allready tried to make i = 0 but it doesnt helped

推荐答案

您在哪里关闭进度条.在内部调用进度条的重置功能,它将为您重置为0.

Where are you dismissing the progress bar. That internally calls the reset function of the progress bar and that will reset it to 0 for you.

这篇关于如何重置进度栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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