Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: indeterminate horizontal progress (dialog) bar

Tags:

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.

like image 513
Jeffrey Blattman Avatar asked May 16 '12 19:05

Jeffrey Blattman


People also ask

How do you make an indeterminate progress bar?

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);

How do I make my progress bar horizontal android?

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.

What is indeterminate progress bar android?

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.

What is indeterminate android?

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.


1 Answers

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" /> 
like image 72
GulBrillo Avatar answered Nov 08 '22 11:11

GulBrillo