3

I am showing a horizontal style, indeterminate ProgressDialog as follows:

progressDialog.setMessage("My progress dialog message");
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setIndeterminate(true);
progressDialog.show();

The indeterminate horizontal progress graphic/animation shows okay. However, give that it's an indeterminate progress dialog, I would expect the "0%" and "0/100" labels on the bottom left and bottom right respectively to be hidden. Anyone know how to hide these?

Adil Hussain
  • 30,049
  • 21
  • 112
  • 147

3 Answers3

6

It is possible to hide those by calling two ProgressDialog's methods

progressDialog.setProgressNumberFormat(null);
progressDialog.setProgressPercentFormat(null);

See ProgressDialog documentation for reference.

Pete
  • 280
  • 3
  • 7
2

Following Andro Selva's comment, the best I've been able to come up with is to use...

progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressDialog.setIndeterminate(false);

... when it's determinate and to use...

progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setIndeterminate(true);

... when it's indeterminate. Not ideal but it works. (The spinner style doesn't show the progress values.)

Adil Hussain
  • 30,049
  • 21
  • 112
  • 147
  • This is the right way to go. Indeterminate should not use `STYLE_HORIZONTAL`. Using `STYLE_SPINNER` looks much better and is better suited for this. – Joshua Pinter Jul 04 '18 at 22:07
2

I know this one is a bit old but maybe my answer helps someone else.

To get a progressdialog which is indeterminate WITHOUT the text bolow I did that:

ProgressBar progressBar = new ProgressBar(this, null, android.R.attr.progressBarStyleHorizontal);
progressBar.setIndeterminate(true);

Dialog progressDialog = new Dialog(context);
progressDialog.setContentView(progressBar);

Hope this helps :)

tadly
  • 71
  • 7