【发布时间】:2013-12-13 21:43:45
【问题描述】:
在我的 ProgressBar 中,我想以 0.0 格式显示进度百分比。我有这段代码,但结果总是向上或向下四舍五入,不显示小数点后的数字。
double value = Double.valueOf(data);
value = numero_a / numero_b *100;
final float numero_float = (float) value;
new Thread(new Runnable() {
float progressStatus = 0;
Handler handler = new Handler();
public void run() {
while (progressStatus < numero_float) {
progressStatus += 1;
handler.post(new Runnable() {
public void run() {
tvPercentuale.setText(progressStatus+"%");
mProgress.setProgress((int)progressStatus);
【问题讨论】: