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

*爱你&永不变心* 提交于 2019-12-06 23:43:22

问题


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:


回答1:


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.




回答2:


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 ?




回答3:


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.



来源:https://stackoverflow.com/questions/22035421/how-to-change-progressdialog-spinner-color-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!