Media Advance Dialog Box With Transparent Background
I would like to set undefined Progress Dialog stuff in my application. I found two ways to achieve this:
1- Using materials-dialogs: https://github.com/afollestad/material-dialogs
2- Using built-in material library dialogs: https://github.com/navasmdc/MaterialDesignLibrary#dialog
Using any of these solutions, I end up with something like this : a dialog with a progress bar in it.
What I would like to get is just a circular progress bar, with no surrounding light gray appearance and no text. Many applications have proven to us that the user knows that when something rotates, he just needs to wait: there is no need to write it in letters. I mean something like this , but stuff.
I don't think this is such a weird question (or does it?), But I haven't been able to find a good answer online. Does any of you know how to achieve this?
thank
[Edit] I have to say that in the gitHub issues of the dialog material library, this seems to be discussed, but the developer quickly closes it down saying it would mean not following the guidelines: https://github.com/afollestad/material- dialogs / issues / 277
source to share
Let's summarize our efforts by the author:
The main goal was to get the effect of the appearance of a dialog box (in particular, dimming the background) for a progress indicator of type "material progress wheel" with a transparent background of the dialog itself.
How we did it (one of the possible ways):
-
This library is used as a material progress wheel.
-
A separate layout file (for example
progress_wheel.xml
) is created that contains the impeller layout<com.pnikosis.materialishprogress.ProgressWheel>...
. If you find yourself in a situation where the dimensions of the wheels do not change according to your layout settings, wrap it in the sizeFrameLayout
with the dimensionswrap_content
. -
Fill this layout with a layout bloat to get an idea, for example.
dialogView
... -
Create a dialog:
Dialog progressDialog = new Dialog(context);
progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
progressDialog.setContentView(dialogView);
progressDialog.show();
- Call this function on
dialogView
to make the dialog transparent:
public static void clearParentsBackgrounds(View view) {
while (view != null) {
final ViewParent parent = view.getParent();
if (parent instanceof View) {
view = (View) parent;
view.setBackgroundResource(android.graphics.Color.TRANSPARENT);
} else {
view = null;
}
}
}
source to share
You can use this code, works great in devices> = 19 (Kitkat)
progress = ProgressDialog.show(Splash.this, null, null, true);
progress.setContentView(R.layout.elemento_progress_splash);
progress.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
progress.show();
progress element splash.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@null"
>
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:backgroundTint="@color/ColorTipografiaAdeudos"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Comprobando sus datos"
android:layout_below="@+id/progressBar1"
android:layout_centerHorizontal="true"
android:id="@+id/textView6"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="@color/ColorFuente"
android:layout_gravity="center_horizontal" />
</RelativeLayout>
source to share