Remove white background ProgressDialog custom android studio

3

I'm customizing a progressDialog in android studio. But when executing a white background is shown as the image shows

Use the following to modify the ProgressDialog:

    progressDialog = new ProgressDialog(context);
    progressDialog.show();
    progressDialog.setContentView(R.layout.custom_progressdialog);
    progressDialog.setCancelable(true);

where custom_progressdialog is the following layout:

<ProgressBar
    android:id="@+id/progressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"/>

<TextView
    android:id="@+id/textView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Cargando"
    android:textStyle="bold"
    android:textColor="@color/progress_text"
    android:layout_marginTop="8dp"/>

Which in turn makes use of the following drawable resource

<solid android:color="@color/progress_bg" />

<corners android:radius="10dp" />

<padding android:left="15dp" android:top="15dp" android:right="15dp" android:bottom="15dp"/>

    
asked by Cesar Alexander Meza Rojas 28.04.2017 в 22:46
source

1 answer

2

Add this:

progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));

That will take away the color of the background that is white and will only leave what you have cusrtomized.

Or you can also do it directly in xml :

Add this to the properties of your layout:

android:background="@android:color/transparent"
    
answered by 28.04.2017 в 23:42