进度条增量 [英] Progress bar increment

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

问题描述

我希望我的进度条每次增加 1,最大值为 5,使用相同的按钮单击此处是我的按钮单击代码

I want my progress bar to increase each time by 1 with maximum value 5 with same button click here is my code in button click

        ProgressBarQuestion.setMax(5);
        ProgressBarQuestion.setProgress(1);
        int progress = ProgressBarQuestion.getProgress();
        Log.e("PROGRESS", String.valueOf(progress));
        ProgressBarQuestion.setProgress(progress++);

但问题是它在第一次点击时增加 1,然后停止增加.

but the problem is it increase by 1 on first click then its stop increasing.

推荐答案

在别处做初始化ONCE

ProgressBarQuestion.setMax(5);
ProgressBarQuestion.setProgress(1);

每次点击时,您都会将进度重置为 1,这样它就不会上升了

Each time you click, you reset the progress back to 1 so it doesn't go up

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

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