Arci
Arci

Reputation: 6819

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

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)

Upvotes: 6

Views: 11240

Answers (3)

EMalik
EMalik

Reputation: 2515

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

Upvotes: 11

med
med

Reputation: 1600

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" 
/>

Upvotes: 3

Arun Kumar
Arun Kumar

Reputation: 2934

Do only progressbar in your xml file

    <ProgressBar 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

or Create ProgressDialog without setting title

ProgressDialog dialog = ProgressDialog.show(ActivityName.this, "", "", true);
        dialog.setCancelable(true);

Upvotes: -1

Related Questions