如何在Android中更改默认的ProgressDialog圆圈颜色 [英] How to change default ProgressDialog circle color in android

查看:69
本文介绍了如何在Android中更改默认的ProgressDialog圆圈颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ProgressDialog显示进度栏

            ProgressDialog progressDialog = new ProgressDialog(context);
            progressDialog.setCancelable(false);
            progressDialog.setMessage(message);
            progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            progressDialog.show();

它会像这样

我想将圆圈的绿色更改为红色.有什么办法吗?

I want to change the green color of the circle to red. is there any way?

我尝试了

.getIndeterminateDrawable().setColorFilter(0xFFFFFFFF, android.graphics.PorterDuff.Mode.MULTIPLY);

但是不起作用.

推荐答案

在style.xml中为对话框创建样式:

In style.xml create style for dialog box :

<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/black</item>
<item name="android:textColorPrimary">@color/white</item>
<item name="android:background">@color/grey_dialog_box</item>
</style>

在此"android:textColorPrimary"中需要定义要显示的颜色,并在Java代码中定义ProgressDialog的样式,例如:

In this "android:textColorPrimary" need to define color you want to show and in java code define style of ProgressDialog like :

ProgressDialog progressDialog = new ProgressDialog(context,R.style.AppCompatAlertDialogStyle);

更多: http://androidprogressdialogcustomcolor.blogspot.in/

这篇关于如何在Android中更改默认的ProgressDialog圆圈颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆