Question: Android 2.3.3

I have a progressdialog that shows, Loading.. as text. Here is the code for the progressdialog .

```
progressDialog = new ProgressDialog(mContext);      
            progressDialog.setIndeterminate(true);
            progressDialog.setMessage("Loading...");
            progressDialog.show();

```

If I remove the line `progressDialog.setMessage("Loading...");`, I get a progressdialog of the left and an empty box on the right that occupies the width of the parent. 

I want to display only the progressdialog , aligned at the center. Please refer to the images below..

This is what i have...

![enter image description here](https://i.stack.imgur.com/fwUlD.png)

This is what i want...

![enter image description here](https://i.stack.imgur.com/Owau1.png)

Can someone help me with this?

Answer: 
Working and looking good on material design with accent color (if you have them)

Tried hard to make it work on both 5.0+ and lower API version. And the solution is to make it with a dialog instead of a progress.

in layout folder create a file **aux\_progress\_spinner.xml**

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@android:color/transparent"
              android:gravity="center"
              android:orientation="vertical" >

    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:background="@android:color/transparent"
        />

</LinearLayout>

```

Create a function somewhere...let's say **Utils.class**

```
   public static Dialog LoadingSpinner(Context mContext){
        Dialog pd = new Dialog(mContext, android.R.style.Theme_Black);
        View view = LayoutInflater.from(mContext).inflate(R.layout.aux_progress_spinner, null);
        pd.requestWindowFeature(Window.FEATURE_NO_TITLE);
        pd.getWindow().setBackgroundDrawableResource(R.color.transparent);
        pd.setContentView(view);
        return pd;
    }

```

**In your fragment/activity call:**

```
 private Dialog progress_spinner;
 progress_spinner = Utils.LoadingSpinner(mContext);   

 //------ Where you want it ------
 progress_spinner.show();

 //------- Dismiss it --------
 progress_spinner.dismiss();

```

**Optional:** add a simple CountDownTimer to test how it looks

```
        new CountDownTimer(1000,1000){

            @Override public void onTick(long millisUntilFinished) {

            }

            @Override public void onFinish() {
                progress.dismiss();
            }
        }.start();

```
This work for me in MonoDroid:

```
progressDialog.SetMessage((string)null);

```

Try this in java:

```
progressDialog.setMessage(null);

```