i need a custom alert dialog for show progress. when i run it the alert dialog background color not change to transparent... below i put my code in xml layout and alert dialog code
xml layout :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:background="@android:color/transparent"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="10dp"
app:cardCornerRadius="100dp">
<ProgressBar
android:id="@+id/progressBar"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="30dp"
android:layout_margin="5dp"
android:layout_height="30dp" />
</androidx.cardview.widget.CardView>
and this is my code in fragment :
View progress = getLayoutInflater().inflate(R.layout.progress_alert, null);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setCancelable(false);
builder.setView(progress);
alertDialog = builder.create();
alertDialog.show();
For me, I tried all the ways, but what worked for me was to delete AlertDialog and replace it with Dialog
and just do this
dialog.getWindow().setBackgroundDrawable(null);