Android position ProgressDialog to top, bottom, etc.

By default the ProgressDialog is positioned at the center of the screen. Here is how you can position it at the bottom of the screen
ProgressDialog myDialog = 
ProgressDialog.show(MyActivity.this, "Display Information","at the bottom...", true);
myDialog.getWindow().setGravity(Gravity.BOTTOM);

You can change the ProgressDialog position by setting the Gravity to top, bottom, etc.

What is a ProgressDialog
A dialog that displays a progress wheel or progress bar. Because it's an extension of the AlertDialog, it also supports buttons.

How to create a ProgressDialogProgressDialog dialog =
ProgressDialog.show(MyActivity.this, "Loading Information","Please wait...", true);

The first parameter is the application Context, the second is a title for the dialog, the third is the message, and the last parameter is whether the progress is indeterminate.

Tip:When you're ready to close your dialog, you can dismiss it by calling dismiss() on the Dialog object.

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.