title: android custom dialog background
body: <p>I need to show a custom dialog in my Android application. Standard <code>AlertDialog</code> design is unacceptable. Android docs say:</p>
  
  <blockquote>
    <p>Tip: If you want a custom dialog, you can instead display an Activity
    as a dialog instead of using the Dialog APIs. Simply create an
    activity and set its theme to Theme.Holo.Dialog in the 
    manifest element:</p>
    
    <p></p>
    
    <p>That's it. The activity now displays in a dialog window instead of
    fullscreen.</p>
  </blockquote>
  
  <p>Sounded promising. I did it, but transparency does not work! Background is always grey:</p>
  
  <p><img src="https://i.stack.imgur.com/3LxWE.png" alt="enter image description here"></p>
  
  <p>Here is a desc in the manifest:</p>
  
  <pre><code>&lt;activity
      android:name=".MyDialogActivity"
      android:screenOrientation="portrait"
      android:theme="@android:style/Theme.Holo.Dialog.NoActionBar" &gt;
  &lt;/activity&gt;
  </code></pre>
  
  <p>Here is a root of my activity:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:background="#00000000"
      android:layout_width="400dp"
      android:layout_height="wrap_content" &gt;
  
      // Content ... //
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I tried also <code>android:background="@null"</code> - effect was the same.
  If I use <code>android:background="#ff0000"</code> then it's red (as it should be). But how do I make it transparent?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I ended up with</p>
  
  <pre><code>&lt;style name="MyThemeDialogCustom" parent="android:Theme.Holo.Dialog.NoActionBar" &gt;
      &lt;item name="android:windowBackground"&gt;@color/transparent&lt;/item&gt;
      &lt;item name="android:colorBackgroundCacheHint"&gt;@null&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>