What's the best way to create an indeterminate, horizontal progress bar? If I do this,
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setIndeterminate(true);
I still get the progress numbers (percent, etc) along the bottom. On ICS, I can do this,
dialog.setProgressNumberFormat(""); dialog.setProgressPercentFormat(new NumberFormat() { @Override public StringBuffer format(double value, StringBuffer buffer, FieldPosition field) { return new StringBuffer(); } @Override public StringBuffer format(long value, StringBuffer buffer, FieldPosition field) { return new StringBuffer(); } @Override public Number parse(String string, ParsePosition position) { return 0; } });
to get rid of the numbers at the bottom, but those two methods are only available on ICS.
By default, every progress bar (created using one of several JProgressBar constructors) is determinate. You may make any JProgressBar indeterminate using the setIndeterminate method: pb. setIndeterminate(true);
In Android, by default a progress bar will be displayed as a spinning wheel but If we want it to be displayed as a horizontal bar then we need to use style attribute as horizontal. It mainly use the “android. widget. ProgressBar” class.
Indeterminate Progress Bar is a user interface that shows the progress of an operation on the screen until the task completes. There are two modes in which you can show the progress of an operation on the screen.
Indeterminate Progress Use indeterminate mode for the progress bar when you do not know how long an operation will take. Indeterminate mode is the default for progress bar and shows a cyclic animation without a specific amount of progress indicated.
Here we go - I just found it. :) android:indeterminateOnly="true" is the key.
<ProgressBar android:id="@+id/progressBar1" style="?android:attr/progressBarStyleHorizontal" android:indeterminateOnly="true" android:layout_width="wrap_content" android:layout_height="wrap_content" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With