Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : How to get rid of weird border around progress dialog

I have made my custom style for progress dialog, however it has weird borders around it.

progress dialog

Here is the theme:

<style name="AppTheme.Dialog" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">@android:color/white</item>
    <item name="android:textColorPrimary">@android:color/white</item>
    <item name="android:background">@color/colorPrimaryDark</item>
    <item name="android:popupBackground">@null</item>
</style>

Any ideas why there is such weird background ?

like image 411
pfulop Avatar asked Nov 30 '15 20:11

pfulop


2 Answers

To remove the colored or white border around the progress dialog have the dialog use a theme that defines a transparent windowBackground

<style name="MyDialogTheme" parent="Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
</style>

When creating the dialog use this theme:

new ProgressDialog(MyActivity.this, R.style.MyDialogTheme);
like image 58
mathmarker Avatar answered Oct 14 '22 13:10

mathmarker


Please add:

your_progress_dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);

to your java.

Hope this helps!

like image 24
Actiwitty Avatar answered Oct 14 '22 13:10

Actiwitty