我创建了一个自定义 ProgressDialog,如下所示:首先我有一个包含 9 个连续图像的动画列表
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@drawable/icon_progress_dialog_drawable_1" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_2" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_3" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_4" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_5" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_6" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_7" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_8" android:duration="150" />
<item android:drawable="@drawable/icon_progress_dialog_drawable_9" android:duration="150" />
然后我有一个自定义样式
<style name="CustomDialog" parent="@android:style/Theme.Dialog" >
<item name="android:windowFrame">@null</item>
<item name="android:windowBackground">@null</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowTitleStyle">@null</item>
<item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:gravity">center</item>
<item name="android:minHeight">70dip</item>
<item name="android:maxHeight">80dip</item>
现在在代码中我将其称为如下
dialog = new ProgressDialog(KaguaHome.this);
dialog.setProgressStyle(R.style.CustomDialog);
dialog.setIndeterminate(true);
dialog.setIndeterminateDrawable(getResources().getDrawable(R.drawable.progress_dialog_icon_drawable_animation));
dialog.show();
结果是
但是,我想实现一个只有图像(无白色背景)的进度对话框,它应该居中,我应该修改什么?