0

Using following code:

ProgressDialog pd = new ProgressDialog(activity);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.show();

This shows spinning progress wheel, but it has a rectangle with white spaces on both sides.

I only need the spinning wheel, nothing else. And also possibly style it better.

Jasper
  • 8,440
  • 31
  • 92
  • 133
  • Look at [http://stackoverflow.com/questions/21751662/create-a-progressdialog-only-with-the-spinner-in-the-middle/21751886#21751886](http://stackoverflow.com/questions/21751662/create-a-progressdialog-only-with-the-spinner-in-the-middle/21751886#21751886) – M D Apr 17 '15 at 10:50
  • MD> That did not work... I deviated only in putting the transparent color value in color.xml file instead of colors.xml (since colors.xml was not there) – Jasper Apr 17 '15 at 11:05

1 Answers1

1

Change ProgressDialog to ProgressBar and put it in the layout where you want to have it:

<ProgressBar
    android:id="@+id/spinningProgressBar"
    style="?android:attr/progressBarStyleLarge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:visibility="gone" >
</ProgressBar>

Set the visibility as you wish in your activity / fragment.

Grender
  • 1,589
  • 2
  • 17
  • 44
  • Gender> Thanks.. but I would prefer not do anything in layouts... is there a way to do this programatically only? – Jasper Apr 17 '15 at 11:21
  • You can, check this question: http://stackoverflow.com/questions/2395769/how-to-programmatically-add-views-to-views Can I ask you why do you want to do it programmatically? – Grender Apr 17 '15 at 11:24
  • Grender> I went with your sugested solution .. works well! Do you know how to style the spinner better.. i.e make it a bit colorful etc.? – Jasper Apr 18 '15 at 12:15
  • Hello Jasper, if you want to style the spinner, the most easy way is to use some libraries, you can check this library for example: https://github.com/Todd-Davies/ProgressWheel – Grender Apr 18 '15 at 13:43