How to show a progress dialog without message (I only need the indeterminate circle)?

10,894

Solution 1

if you need a only spinning wheel without box, you can use like this.

<ProgressBar
       style="?android:attr/progressBarStyle"
       android:layout_gravity="center_horizontal"
       android:id="@+id/progressbar_downloading"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content" 
/>

Solution 2

Hope this will help some as answer is still not easily found.

ProgressDialog progDialog = ProgressDialog.show( getContext(), null, null, false, true );
progDialog.getWindow().setBackgroundDrawable( new ColorDrawable( Color.TRANSPARENT ) );
progDialog.setContentView( R.layout.progress_bar );

2nd line above will remove the box around the progress Circle icon; but it will stay left aligned by default. You will have to add the third line above to handle gravity and any other style in a XML layout file.

progress_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" />

You do not have to define the style above if you like the default smaller circle Icon

Share:
10,894
Arci
Author by

Arci

An Android and J2EE developer.

Updated on August 08, 2022

Comments

  • Arci
    Arci almost 2 years

    How can I show a progress dialog without the message?

    I only need to show the indeterminate circle. What is the easiest and fastest way of doing this without creating a custom dialog? Is there any method similar to this:

    progressDialog.setShowIndeterminateCircleOnly(true)