做一个透明的ProgressDialog等待框。

在values/styles.xml添加自定义style

<style name="TRANSDIALOG" parent="@android:style/Theme.Dialog">
        <item name="android:backgroundDimEnabled">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFrame">@null</item>
        <item name="android:windowIsFloating">true</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:background">@null</item>
        <item name="android:windowBackground">@null</item>
    </style>

在color.xml添加透明颜色

<color name="transparent">#0000</color>
 

在layout添加布局文件trans_dialog.xml

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

最后显示出来

Dialog waitDialog = new Dialog(this, R.style.TRANSDIALOG);
                waitDialog.setContentView(R.layout.trans_dialog);
                waitDialog.getWindow().setBackgroundDrawableResource(R.color.transparent);
                waitDialog.show();

收工!其他dialog布局可以此去修改