在创建一个不需要背景的弹框时:
public static Dialog createLoadingDialog(Activity activity) {
if (activity == null || activity.isFinishing()) {
return null;
}
Dialog dialog = new Dialog(activity,R.style.LoadingDialog);
dialog.setContentView(View.inflate(activity,R.layout.dialog_londing,null));
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
return dialog;
}
样式:
<style name="LoadingDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">false</item>
<item name="android:windowAnimationStyle">@android:style/Animation.Toast</item>
</style>