Skip to content

10 The class ProgressDialog

Michael Rapp edited this page Dec 27, 2017 · 1 revision

The class ProgressDialog.Builder implements a builder, which allows to create dialogs, which can be used to indicate a running progress. Besides a circular progress bar such dialogs can contain a title, a message and up to three buttons.

For configuring the dialog's title, message and buttons the methods and theme attributes, which have already been discussed and are similar to those of the class MaterialDialog.Builder can be used. Furthermore, the following methods are provided by the class MaterialDialog.Builder:

Setter methods Description Default value Restrictions
setProgressBarColor(int):Builder Sets the color of the dialog's progress bar. R.attr.colorAccent Must be a valid color, not a resource ID.
setProgressBarSize(int):Builder Sets the size of the dialog's progress bar in pixels. R.dimen.circular_progress_bar_size_normal The size must be at least 1.
setProgressBarThickness(int):Builder Sets the thickness of the dialog's progress bar in pixels. R.dimen.circular_progress_bar_thickness_normal The thickness must be at least 1.
setProgressBarPosition(ProgressBarPosition):Builder Sets the position of the dialog's progress bar in relative to the message. ProgressBarPosition.LEFT The position may not be null.

As an alternative to using the setter methods shown above, theme attributes, which are shown in the table below, can be used to change the appearance of the dialog.

Theme atttribute Description Format
materialDialogProgressBarColor Specifies the color of the dialogs' progress bars. color
materialDialogProgressBarSize Specifies the size of the dialogs' progress bars. dimension
materialDialogProgressBarThickness Specifies the thickness of the dialogs' progress bars. dimension
materialDialogProgressBarPosition Specifies the position of the dialogs' progress bars. enum