title: How can I change the background of Android alert dialogs?
body: <p>I use the AlertDialog class in my application. By default, these alert dialogs have a transparent background. I'm trying to use an opaque background instead, very unsuccessfully. These are my styles:</p>
  
  <pre><code>&lt;style name="MyOpaqueActivity" parent="@android:style/Theme.Dialog"&gt;
      &lt;item name="android:windowBackground"&gt;@drawable/my_background&lt;/item&gt;
      &lt;item name="android:alertDialogStyle"&gt;@style/MyOpaqueAlertDialog&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="MyOpaqueAlertDialog" parent="@android:style/Theme.Dialog.Alert"&gt;
      &lt;item name="android:background"&gt;#454545&lt;/item&gt;
      &lt;item name="android:windowBackground"&gt;@drawable/my_background&lt;/item&gt;
      &lt;item name="android:popupBackground"&gt;@drawable/my_background&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>I applied the "MyOpaqueActivity" style successfully for whole activities (the window background is changed to "my_background"), but it doesn't work for alert dialogs within those activities. The "alertDialogStyle" attribute and my "MyOpaqueAlertDialog" style don't seem to have any effect.</p>
  
  <p>So how can I change the background of these alert dialogs?</p>