android 自定义 ProgressDialog 在5.0以上出现白色背景的解决方法

来源:互联网 发布:sql 字段去重复查询 编辑:程序博客网 时间:2024/06/06 03:49

需要自定义样式:

<style name="myDialog" parent="@android:style/Theme.Dialog">    <item name="android:windowFrame">@null</item>    <item name="android:windowIsFloating">true</item>    <item name="android:windowContentOverlay">@null</item>    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item></style><style name="myProgressDialog" parent="@style/myDialog">    <item name="android:windowBackground">@android:color/transparent</item>    <item name="android:windowNoTitle">true</item></style>

然后在带样式参数的构造方法中设置样式:

public SimpleProgressDialog(Context context) {    super(context, R.style.myProgressDialog);    this.context = context;    this.setIndeterminate(true);    this.setCancelable(true);    this.getWindow().setGravity(Gravity.CENTER);}


阅读全文
0 0