title: Android Activity transparent background
body: <p>I have a pretty common requirement. </p>
  
  <p>I have an Activity that needs to appear Full-screen on Mobile Devices (Size-Normal), and as a Dialog on Tablet Devices(Size-Large and Size-XLarge).</p>
  
  <p>In both the formats, I have UI-Widgets displayed in the content-view of the Activity such as a Horizontal-ProgressBar, Circular-ProgressBar as a load-indicator etc, which need to follow a consistent Material-Design with Custom-Branded colors etc. I cannot forgo this requirement.</p>
  
  <p>I have defined custom-styles based on default Android Themes and Styles, and use them across the App for all Activities. Following are the custom-themes.</p>
  
  <pre><code>&lt;!-- Base application theme. --&gt;
  &lt;style name="AppTheme" parent="Theme.AppCompat.NoActionBar"&gt;
      &lt;item name="android:colorPrimary" tools:ignore="NewApi"&gt;
          @color/light_black
      &lt;/item&gt;
      &lt;item name="colorPrimary"&gt;@color/light_black&lt;/item&gt;
      &lt;item name="android:colorAccent" tools:ignore="NewApi"&gt;@color/sapphire&lt;/item&gt;
      &lt;item name="colorAccent"&gt;@color/sapphire&lt;/item&gt;
      &lt;item name="android:colorBackground"&gt;@color/primary_background&lt;/item&gt;
      &lt;item name="android:textColorPrimary"&gt;@color/title_color&lt;/item&gt;
      &lt;item name="android:colorButtonNormal" tools:ignore="NewApi"&gt;@color/sapphire&lt;/item&gt;
      &lt;item name="colorButtonNormal"&gt;@color/sapphire&lt;/item&gt;
      &lt;item name="android:colorForeground" tools:ignore="NewApi"&gt;
          @color/title_color
      &lt;/item&gt;
      &lt;item name="android:titleTextStyle"&gt;@style/toolbar_title&lt;/item&gt;
      &lt;item name="android:navigationIcon" tools:ignore="NewApi"&gt;?android:attr/homeAsUpIndicator&lt;/item&gt;
      &lt;item name="navigationIcon"&gt;?android:attr/homeAsUpIndicator&lt;/item&gt;
      &lt;item name="android:colorControlNormal" tools:ignore="NewApi"&gt;@color/white&lt;/item&gt;
      &lt;item name="colorControlNormal"&gt;@color/white&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="AppTheme.Light" parent="AppTheme"&gt;
      &lt;item name="android:windowBackground"&gt;@color/white&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="AppTheme.Dialog" parent="AppTheme.Light"&gt;
      &lt;item name="android:windowBackgroundFallback" tools:ignore="NewApi"&gt;
          @android:color/transparent&lt;/item&gt;
      &lt;item name="android:windowBackground"&gt;@android:color/transparent&lt;/item&gt;
      &lt;item name="android:colorBackgroundFloating" tools:ignore="NewApi"&gt;
          @android:color/transparent&lt;/item&gt;
      &lt;item name="windowActionBar"&gt;false&lt;/item&gt;
      &lt;item name="windowActionBarOverlay"&gt;false&lt;/item&gt;
      &lt;item name="windowActionModeOverlay"&gt;false&lt;/item&gt;
      &lt;item name="android:windowContentOverlay"&gt;@null&lt;/item&gt;
      &lt;item name="android:windowClipToOutline" tools:ignore="NewApi"&gt;false&lt;/item&gt;
      &lt;item name="android:windowTitleStyle"&gt;@null&lt;/item&gt;
      &lt;item name="android:windowTitleBackgroundStyle"&gt;@null&lt;/item&gt;
      &lt;item name="android:windowIsTranslucent"&gt;true&lt;/item&gt;
      &lt;item name="android:windowNoTitle"&gt;true&lt;/item&gt;
      &lt;item name="android:windowIsFloating"&gt;true&lt;/item&gt;
      &lt;item name="android:windowCloseOnTouchOutside"&gt;true&lt;/item&gt;
      &lt;item name="android:windowEnableSplitTouch"&gt;true&lt;/item&gt;
      &lt;item name="android:fitsSystemWindows"&gt;true&lt;/item&gt;
      &lt;item name="android:fillViewport"&gt;true&lt;/item&gt;
      &lt;item name="android:backgroundDimEnabled"&gt;true&lt;/item&gt;
      &lt;item name="android:backgroundDimAmount"&gt;0.2&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>I use the AppTheme as the default theme across all Activities in the App, and AppTheme.Dialog for the specific Activity described above only for Tablet Devices. The Activity does appear as a Floating-Dialog window centered in the Tablet Screen, dismisses when touched outside like a typical Dialog, everything is good, but the problem is that the Activity's window-background is like pitch-ink-black.</p>
  
  <p>My requirement is that the Activity as a Floating-Dialog in Tablet Devices should have a Transparent Background showcasing the previous activity window-content possibly dimmed and darkened.</p>
  
  <p>How do I achieve this, without having to use Theme.Dialog or Theme.Translucent, as I said before, I need the Material-Design specs for the UI-Widgets not to change from the original "AppTheme" style.</p>
  
  <p>I also will need to re-use a lot of custom private methods declared in the Activity class, so loading the content-view layout-file into a Dialog instance is most definitely not preferred.</p>
  
  <p>Oh, btw, compileSdkVersion is latest at 24, minSdkVersion is 16 and targetSdkVersion is 24, buildToolsVersion is also latest at 24.0.1, but that's a different concern altogether.</p>