Android:旋转 ProgressDialog - 如何?
Android: Spinning ProgressDialog - How?
使用以下代码:
ProgressDialog pd = new ProgressDialog(activity);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.show();
这显示了旋转的进度轮,但它有一个两边都有空白的矩形。
我只需要纺车,没有别的。
也可能设计得更好。
将ProgressDialog
更改为ProgressBar
并将其放在您想要的布局中:
<ProgressBar
android:id="@+id/spinningProgressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" >
</ProgressBar>
根据需要在 activity / 片段中设置可见性。
使用以下代码:
ProgressDialog pd = new ProgressDialog(activity);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.show();
这显示了旋转的进度轮,但它有一个两边都有空白的矩形。
我只需要纺车,没有别的。 也可能设计得更好。
将ProgressDialog
更改为ProgressBar
并将其放在您想要的布局中:
<ProgressBar
android:id="@+id/spinningProgressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" >
</ProgressBar>
根据需要在 activity / 片段中设置可见性。