title: Android: How to display transparent loading layer above the activity
body: <p>I have tested 2 methods to display a transparent loading layer (progress bar) above the activity but activity content gets hidden here's the first one:</p>
  
  <pre><code>&lt;RelativeLayout
    android:id="@+id/loadingPanel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center" &gt;
  
    &lt;ProgressBar
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:indeterminate="true" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>And the other method with style</p>
  
  <pre><code>&lt;RelativeLayout
    style="@style/GenericProgressBackground"
    android:id="@+id/loadingPanel"&gt;
    &lt;ProgressBar
      style="@style/GenericProgressIndicator"/&gt;
  &lt;/RelativeLayout&gt;
  
  &lt;style name="GenericProgressBackground" parent="android:Theme"&gt;
    &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt;
    &lt;item name="android:layout_height"&gt;fill_parent&lt;/item&gt;
    &lt;item name="android:background"&gt;#DD111111&lt;/item&gt;
    &lt;item name="android:gravity"&gt;center&lt;/item&gt;
  &lt;/style&gt;
  &lt;style name="GenericProgressIndicator"  arent="@android:style/Widget.ProgressBar.Small"&gt;
    &lt;item name="android:layout_width"&gt;wrap_content&lt;/item&gt;
    &lt;item name="android:layout_height"&gt;wrap_content&lt;/item&gt;
    &lt;item name="android:indeterminate"&gt;true&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>And hide or display it</p>
  
  <pre><code>findViewById(R.id.loadingPanel).setVisibility(View.GONE);
  </code></pre>
  
  <p>(Both are added as the first item inside the root view)</p>
  
  <p>But both methods hide the activity and I want to be visible semi-transparent like the image below how can I do that?</p>
  
  <p><a href="https://i.stack.imgur.com/bsZ1z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bsZ1z.png" alt="enter image description here"></a></p>