I am creating a ProgressBar in my app programmatically it is of SPIN style by default however I want it in HORIZONTAL style. I don't see any method/constant to achieve this.
And I don't want to use ProgressDialog as it'd be inconsistent with my App UI theme.
Any suggestions please?
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.
ProgressDialog mProgressDialog = new ProgressDialog(this); mProgressDialog. setIndeterminate(true); mProgressDialog. setMessage("Loading..."); mProgressDialog. show(); retrofitService.
Android ProgressBar is a graphical view indicator that shows some progress. Android progress bar displays a bar representing the completing of the task. Progress bar in android is useful since it gives the user an idea of time to finish its task.
app. ProgressDialog class to show the progress bar. Android ProgressDialog is the subclass of AlertDialog class. The ProgressDialog class provides methods to work on progress bar like setProgress(), setMessage(), setProgressStyle(), setMax(), show() etc.
use this:
ProgressBar pb = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
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