如何改变进度对话框的位置?对话框、进度、位置

2023-09-11 23:32:58 作者:–具死ㄕ℡

我开发一个Android应用程序,并且需要知道如何改变进度对话框的定位。予需要它被定位在屏幕的底部,而不是在中心像它是由缺省

I'm developing an android app and need to know how to change the positioning of a progress dialog. I need it to be positioned at the bottom of the screen instead of at the center like it is by default.

推荐答案

您可以致电 ProgressDialog#getWindow#setGravity(...)来改变重力。

You can call ProgressDialog#getWindow#setGravity(...) to change the gravity.

所以:

ProgressDialog dialog = ProgressDialog.show(AContext, "Test", "On the bottom");
                dialog.getWindow().setGravity(Gravity.BOTTOM);