Android Progress Loading Dialog

by GarciaPL on Monday 9 November 2015

Some of you might be looking for some solution to display progress loading dialog. I have used below example it in one of my Android application compiled against API 23 (Android 6.0). That's why on first glance you might think that style theme which I used in this case is overloaded. You need just to adjust it to your own purposes.

<style name="LoadingDialogTheme">
    <item name="colorAccent">#1976D2</item>
    <item name="android:textColor">#1976D2</item>
    <item name="android:textColorPrimary">#1976D2</item>
    <item name="android:textColorSecondary">#1976D2</item>
    <item name="android:windowFrame">@null</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowTitleStyle">@null</item>
    <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
    <item name="android:windowSoftInputMode">stateUnspecified|adjustPan</item>
    <item name="android:backgroundDimEnabled">false</item>
    <item name="android:background">@android:color/transparent</item>
</style>

Above style should be added in styles.xml. Then you can use this style with ProgressDialog as below.


ProgressDialog progressDialog = new ProgressDialog(MainActivity.this, R.style.LoadingDialogTheme);
progressDialog.setMessage(getString(R.string.dialog_loading_content));
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(true);
progressDialog.show();


And the final result is as this one :