Android,更改进度对话框背景颜色?

Android,更改进度对话框背景颜色?,android,progressdialog,Android,Progressdialog,我有一个完全由java代码定义的进度对话框。我只想改变背景颜色,可能还有文字颜色。我在stackoverflow中看到过其他帖子,比如添加style.xml等等,但没有一篇有效。请不要把我介绍给其他的帖子。怎么办? 我的代码听起来像这样: Class A extends Activity { ProgressDialog pd; Context context; public void onCreate(){ context = A.this; pd = new

我有一个完全由java代码定义的进度对话框。我只想改变背景颜色,可能还有文字颜色。我在stackoverflow中看到过其他帖子,比如添加style.xml等等,但没有一篇有效。请不要把我介绍给其他的帖子。怎么办? 我的代码听起来像这样:

 Class A extends Activity {
   ProgressDialog pd;
   Context context;
   public void onCreate(){
   context = A.this;
   pd = new ProgressDialog.show(context, "" , "Loading");
   }
 }
在代码中执行以下操作:

Class A extends Activity {
   ProgressDialog pd;
   Context context;
   public void onCreate(){
   context = A.this;
   pd = new ProgressDialog(context, android.R.style.Theme_DeviceDefault_Light_Dialog_Alert);
   pd.setTitle("");
   pd.setMessage("Loading");
   pd.show();
   }
 }

默认颜色是白色吗?不,是黑色。实际上,我想将其更改为白色。您是否在style.xml中使用了项目
android:alertDialogStyle
?请阅读我给Eric B留下的评论。谢谢。我以前使用过style.xml并成功更改了pd,但结果并不是我所期望的。我只需要一个简单的白色pd,里面有一个旋转的圆圈。就像Instagram应用程序一样,在向下滚动关注者或媒体列表时。每个style.xml都需要一个不符合我的情况的父主题。“结果不是我所期望的”当您这样做时,pd如何?你能把instagram上的图片贴出来让我有个想法吗?我上传了一张我想要的截屏。这不是进度对话框。这更像是一个进度条,一个不确定的进度条。你可以控制它的可见性,让它消失,或者你想要的任何东西都可见。
pd = new ProgressDialog.show(context, "" , "Loading");
pd.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.RED));