我在调用服务器期间使用这个库来制作动画。
也就是说,我创建了一个带有动画的xml文件
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.zl.reik.dilatingdotsprogressbar.DilatingDotsProgressBar
android:id="@+id/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:color="@color/button_background_stroke"
android:radius="6dp"
app:dd_animationDuration="500"
app:dd_horizontalSpacing="8dp"
app:dd_numDots="6"
app:dd_scaleMultiplier="2" />
</RelativeLayout>
显示动画AlertDialog.Builder
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
View view2 = inflater.inflate(R.layout.progress_animation, container, false);
builder.setView(view2);
DilatingDotsProgressBar dotsProgressBar = (DilatingDotsProgressBar)
view2.findViewById(R.id.progress);
dotsProgressBar.showNow();
mProgressDialog = builder.create();
mProgressDialog.show();
一切似乎都很好,但动画的背景令人不快(在本例中为白色)
是否有可能以某种方式删除这个白色背景?或者有没有比使用动画更好的方法AlertDialog?

您需要用
AlertDialog常规替换它并Dialog为其设置以编程方式透明的背景:您还需要在所有元素的对话框标记中放置透明背景。
基于这个答案