8

I am trying to add a customized ProgressDialog to my Activity. I successfully changed the ProgressDialog font and the background colors, but I don't know how to change the spinner color without using a widget. Can anyone help me?

This is my Activity code:

 myPd_bar=new ProgressDialog(Ratings.this,R.style.Theme_MyDialog);
 myPd_bar.setMessage("Loading....");
 myPd_bar.setTitle(null);
 myPd_bar.show();

This is my styles.xml code:

<style name="Theme.MyDialog" parent="@android:style/Theme.Dialog">
    <item name="android:textColor">#daac56</item>
    <item name="android:background">#160203</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>
</style>

And this is the current output:

enter image description here

Ben
  • 7,548
  • 31
  • 45
anuruddhika
  • 1,549
  • 8
  • 26
  • 40
  • refer this one maybe helpful http://stackoverflow.com/questions/5337613/how-to-custom-circular-progress-bar-color – Aravin Feb 26 '14 at 08:15
  • @Aravinth i did not use any widget here. I used ProgressDialog. – anuruddhika Feb 26 '14 at 08:19
  • The better response for this is http://stackoverflow.com/a/22072093/176977, the specific questions was spinner (progress) inside a ProgressDialog. – Juvs Jan 12 '16 at 03:28

3 Answers3

2

You would have to find the asset of the progressbar and change the color manually with Photoshop or some other image editing program.

If you really want to style your progressbar, I would recommend taking a look at the HoloEverywhere library, which gives your app the Android 4.0 Holo style, compatible with older versions of Android, it looks really nice.

By the way, the Android design guidelines say it's unnecessary to add the "Loading..." text next to the progress bar. The progressbar is enough to indicate the user that your app is loading. They also say it is nicer to embed the progressbar somewhere in your app, rather than displaying it in a dialog.

enter image description here

Mark Buikema
  • 2,483
  • 30
  • 53
1

You can't... because the spinner is different on all android versions (2.3, 4.0, ...)

If you want to change the spinner,

  1. you have to create your own maybe in .gif format.

Or

  1. maybe try to set the transparancy and change the color in background.

But why change the spinner ? Is it really important ?

Cocorico
  • 1,998
  • 1
  • 22
  • 38
  • 1
    According to my designing i thought that should match with my app customized theme. Thats why i trid. – anuruddhika Feb 26 '14 at 08:32
  • Ok, but if you take a look at all app in Android, you always see the basic spinner. Maybe there is a reason... Personally, I never see a "custom" spinner. – Cocorico Feb 26 '14 at 08:41
  • Maybe, take a look at this : https://developer.android.com/design/building-blocks/progress.html – Cocorico Feb 26 '14 at 08:45
1

It won't be easy to change the colour of the spinner.

If you wan't to have a different colour on the spinner the easiest will be to create your own progressdialog (extend it from the current). And then do a customized animation.

Anders Metnik
  • 6,096
  • 7
  • 40
  • 79