Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change ProgressDialog Spinner color in Android? [duplicate]

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

like image 584
anuruddhika Avatar asked Feb 26 '14 08:02

anuruddhika


3 Answers

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

like image 106
Mark Buikema Avatar answered Oct 18 '22 02:10

Mark Buikema


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 ?

like image 1
Cocorico Avatar answered Oct 18 '22 04:10

Cocorico


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.

like image 1
Anders Metnik Avatar answered Oct 18 '22 04:10

Anders Metnik