Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当进度走到80%,为什么会变成-%79, - %78 ....... #73

Open
roybill opened this issue Apr 20, 2019 · 1 comment
Open

当进度走到80%,为什么会变成-%79, - %78 ....... #73

roybill opened this issue Apr 20, 2019 · 1 comment

Comments

@roybill
Copy link

roybill commented Apr 20, 2019

myBody = new MyBody(requestBody, new MyBody.ProgressListener() { @Override public void onProgress(long currentBytes, long contentLength) { int current = new Long(currentBytes).intValue(); int total = new Long(contentLength).intValue(); if (seted) { numberProgressBar.setMax(total); //只设置一次最大值 seted = false; } numberProgress.setProgress(current); } }); mShow = builder.show();

@daiji168
Copy link

int值发生了越界。
把NumberProgressBar类中的这一行mCurrentDrawText = String.format("%d", getProgress() * 100 / getMax());改成
float pressent = (float) getProgress() / getMax() * 100;
mCurrentDrawText=String.valueOf((int)pressent);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants