android - Why the background of ProgressDialog doesn't set to the transparent? -
i want set ground transparent , have set following code in
styles.xml <style name="dialog" 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> <item name="android:windowbackground">@android:color/transparent</item> <item name="android:windownotitle">true</item> </style>
and have use progressdialog
following code in java file
, in fragment
.
activity activity = getactivity() ; mprogressdialog = new progressdialog(activity,r.style.dialog) ; mprogressdialog.setcancelable(false) ; mprogressdialog.show() ;
but progress following picture , , doesn't has transparent background.
why background doesn't change transparent ?
create custom mytheme
in values\styles.xml
<style name="mytheme" parent="android:theme.holo.dialog"> <item name="android:alertdialogstyle">@style/customalertdialogstyle</item> <item name="android:windowbackground">@android:color/transparent</item> <item name="android:textcolorprimary">#ffffff</item> <item name="android:backgrounddimenabled">false</item> <item name="android:textcolor">#ffffff</item> <item name="android:textstyle">normal</item> <item name="android:textsize">12sp</item> </style>
and add customalertdialogstyle
in values\styles.xml
<style name="customalertdialogstyle"> <item name="android:bottombright">@android:color/transparent</item> <item name="android:bottomdark">@android:color/transparent</item> <item name="android:bottommedium">@android:color/transparent</item> <item name="android:centerbright">@android:color/transparent</item> <item name="android:centerdark">@android:color/transparent</item> <item name="android:centermedium">@android:color/transparent</item> <item name="android:fullbright">@android:color/transparent</item> <item name="android:fulldark">@android:color/transparent</item> <item name="android:topbright">@android:color/transparent</item> <item name="android:topdark">@android:color/transparent</item> </style>
and set progressdialog
like:
pd = new progressdialog(getactivity(),r.style.mytheme); pd.setcancelable(false); pd.setprogressstyle(android.r.style.widget_progressbar_small); pd.show();
Comments
Post a Comment