1.定义AlertDialog透明样式
<style name="TransparentDialog" parent="Theme.AppCompat.Dialog">
<item name="android:windowBackground">@color/transparent</item>
</style>
colors.xml
<color name="transparent">#00000000</color>
2.创建AlertDialog
View contentView= LayoutInflater.from(context).inflate(R.layout.dialog_progress, null);
AlertDialog.Builder builder=new AlertDialog.Builder(context,R.style.TransparentDialog);
builder.setView(contentView);
builder.setCancelable(false);
builder.show();