title: Android Custom Dialog with transparent window Background breaks my button selector
body: <p>I am making a custom dialog with a transparent window background set in the style. I have another button in my activity behind the dialog set with the same button_selector as the background, and it works fine, so I know the problem is something with the style and more specifically the windowBackground attribute. </p>
  
  <p>Does anyone know how I can get a transparent window background for my custom dialog but still allow my button selector to work properly?</p>
  
  <p>Included are pictures of how it looks with the button background set to @drawable/lightblue1, and @drawable/button_selector.</p>
  
  <p>this is my style xml</p>
  
  <pre><code>&lt;resources&gt;
     &lt;style name="CustomDialogTheme" parent="@android:style/Theme.Dialog"&gt;
       &lt;item name="android:windowBackground"&gt;@color/transparent&lt;/item&gt;
       &lt;item name="android:windowIsFloating"&gt;false&lt;/item&gt;
       &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
    &lt;/style&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>If I remove the <code>&lt;item name="android:windowBackground"&gt;@color/transparent&lt;/item&gt;</code> line then my button selector works correctly, but my dialog is put inside the systems default dialog container background.</p>
  
  <p>This is my button declaration xml. If i change @drawable/button_selector to one of the actual png files then it appears correctly, but with the selector my button background gets set to transparent.</p>
  
  <pre><code>  &lt;Button
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/button_selector"
    android:layout_marginBottom="15dp"
    android:textSize="35sp"
    android:text="@string/btnText1"&gt;
    &lt;/Button&gt;
  </code></pre>
  
  <p>Here is how I create the dialog from java:</p>
  
  <pre><code> Dialog dialog = new Dialog(TimeClock.this, R.style.CustomDialogTheme);
   dialog.setContentView(R.layout.tag);
   dialog.show();
  </code></pre>
  
  <p>Here is the button_selector.xml</p>
  
  <pre><code> &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
       &lt;item android:state_pressed="true"
             android:drawable="@drawable/darkblue1" /&gt; &lt;!-- pressed --&gt;
       &lt;item android:state_focused="true"
             android:drawable="@drawable/darkblue1" /&gt; &lt;!-- focused --&gt;
       &lt;item android:drawable="@drawable/lightblue1" /&gt; &lt;!-- default --&gt;
   &lt;/selector&gt;
  </code></pre>
  
  <p><strong>EDIT: I ended up "faking" my dialog with a translucent activity so that I could get better control over its appearance.</strong> </p>
  
  <p><img src="https://i.stack.imgur.com/fwfJK.png" alt="with button set to the the png file">
  <img src="https://i.stack.imgur.com/bdUy7.png" alt="with button set from the selector"></p>