我有一个由java代码完全定义的进度对话框。我只是想改变背景颜色和文字颜色。我已经在stackoverflow中看到了其他帖子,比如添加style.xml等等,但都没有用。请不要将我推荐给其他帖子。该怎么办? 我的代码听起来像这样:
Class A extends Activity {
ProgressDialog pd;
Context context;
public void onCreate(){
context = A.this;
pd = new ProgressDialog.show(context, "" , "Loading");
}
}
![A sample of progress dialog which i want. Actually i have it , but the problem is the background color which i want to be white.] 1
答案 0 :(得分:1)
pd = new ProgressDialog.show(context, "" , "Loading");
pd.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.RED));
答案 1 :(得分:0)
在您的代码中执行此操作:
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();
}
}