ProgressDialog.show()
are static methods, so you don't get a class instance of ProgressDialog
that you can set properties on.
To get a ProgressDialog
instance:
// create a ProgressDialog instance, with a specified theme:
ProgressDialog dialog = new ProgressDialog(mContext, ProgressDialog.THEME_HOLO_DARK);
// set indeterminate style
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
// set title and message
dialog.setTitle("Please wait");
dialog.setMessage("Loading dictionary file...");
// and show it
dialog.show();
EDIT 8/2016:
Regarding the comments about deprecated themes, you may also use styles.xml and inherit from a base theme, e.g.:
<style name="MyProgressDialog" parent="Theme.AppCompat.Dialog">
</style>
the details on how to do this are already covered extensively elsewhere, start with https://developer.android.com/guide/topics/ui/themes.html.
Using themes and styles.xml is (in my opinion) a much cleaner and easier to maintain solution than hard-coding a theme when instantiating the ProgressDialog, i.e. set it once and forget it.
Then you can just do
new ProgressDialog(mContext);
and let your global theme/style provide the styling.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…