title: DialogFragment default bakcground color change - Android
body: <p>I have implemented my own Dialog by inheriting from the DialogFragment class.</p>
  
  <p>I want to change the background colour of this default Dialog.</p>
  
  <p>I have tried a couple of ways but none of them seem to work. 
  If you see the onCreateDialog() method below, I am using a custom dialog Style:</p>
  
  <pre><code>public class ConfirmationDialogFragment extends SherlockDialogFragment {
  
  String mTextMessage = "Would you like to save the message"; 
  String mTextButtonOk = "Ok";
  TestDialogInterface dialogInterface = null;
  
  public void setDialogInterface(TestDialogInterface dialogInterface) {
      this.dialogInterface = dialogInterface;
  }
  
  /**
   */
  public ConfirmationDialogFragment() {       
  }
  
  public void setTextMessage(String mTextMessage) {
      this.mTextMessage = mTextMessage;
  }
  
  
  @Override
  public Dialog onCreateDialog(Bundle savedInstanceState) {
      AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(getActivity(), R.style.AlertDialogCustom));
      builder.setMessage(mTextMessage)
             .setPositiveButton(mTextButtonOk, new DialogInterface.OnClickListener() {
                 public void onClick(DialogInterface dialog, int id) {
                     dismiss();
                 }
             })
             .setCancelable(false);                
      builder.setTitle("Loan Extension");
      Dialog dialog = builder.create();
      return dialog;
  }   
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      View view = super.onCreateView(inflater, container, savedInstanceState);
      return view;        
  }
  
  public class TestDialogInterface{
      public void onYes(){}
      public void onNo(){}        
  }    
  </code></pre>
  
  <p>}</p>
  
  <p>And the styles file look like: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;style name="AlertDialogCustom" parent="@android:style/Theme.DeviceDefault.Light.Dialog"&gt;        
          &lt;item name="android:windowBackground"&gt;@color/red&lt;/item&gt;
          &lt;item name="android:colorBackground"&gt;@color/red&lt;/item&gt;                              
      &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>However the windowBackground style-item seems to have no effect. I need to change the background color of this default Dialog.</p>
  
  <p>Anyone has a clue ????</p>