Reputation: 69
I have a progress dialog fully defined by java code. I just want to change the background color and probably text color. I've seen other posts in stackoverflow like adding style.xml and so on, but none worked. Please don't refer me to other posts. What to do? My code sounds like this:
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
Upvotes: 2
Views: 2319
Reputation: 628
pd = new ProgressDialog.show(context, "" , "Loading");
pd.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.RED));
Upvotes: 4
Reputation: 4702
Do this in your code:
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();
}
}
Upvotes: 0