title: Creating Android Transparent Layout in Custom Alert Dialog
body: <p>I have written a Custom Dialog, which works perfectly fine.</p>
  
  <pre><code>public class GalleryAlertDialog extends Dialog {}
  </code></pre>
  
  <p>In a class I call the class with the </p>
  
  <pre><code>dialog.show();
  </code></pre>
  
  <p>I want to achieve this look: </p>
  
  <p><img src="https://i.stack.imgur.com/hadnF.jpg" alt="enter image description here"></p>
  
  <p>I need the button over the dialog,like this. </p>
  
  <p>However, this is what I get:</p>
  
  <p><img src="https://i.stack.imgur.com/Zl7a9.jpg" alt="enter image description here"></p>
  
  <p>Here's the layout xml's part where I declare the layout and the button inside it:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/llContainer"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_gravity="center_vertical"
  android:orientation="vertical"&gt;
  
  &lt;LinearLayout
      android:id="@+id/ll_buttonContainer"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_marginBottom="5dip"
      android:gravity="right"
      android:orientation="vertical" &gt;
  
      &lt;ImageButton
          android:id="@+id/btn_close"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_weight="1"
          android:background="@drawable/selector_button_popupclose"
          android:contentDescription="TODO"
          android:tag="btn_close" /&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/ll_pagerContainer"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content" &gt;
  
      &lt;FrameLayout
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" &gt;
  
          &lt;android.support.v4.view.ViewPager
              android:id="@+id/pager"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_below="@+id/ll_buttonContainer"
              android:layout_marginTop="80dip"
              android:background="@color/white" /&gt;
  
         &lt;ToggleButton
                      android:id="@+id/tbFavorite"
                      android:layout_width="35dip"
                      android:layout_height="35dip"
                      android:layout_gravity="bottom|right"
                      android:layout_marginBottom="10dp"
                      android:layout_marginRight="10dip"
                      android:background="@drawable/selector_check"
                      android:checked="false"
                      android:focusable="false"
                      android:focusableInTouchMode="false"
                      android:textOff=""
                      android:textOn="" /&gt;
  
      &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:background="#ff212121"
      android:gravity="center_vertical"
      android:orientation="horizontal" &gt;
  
      &lt;LinearLayout
          android:id="@+id/llContactFullName"
          android:layout_width="wrap_content"
          android:layout_height="fill_parent"
          android:layout_weight="1"
          android:background="@color/white"
          android:gravity="left|center_vertical"
          android:orientation="vertical" &gt;
  
          &lt;View
              android:layout_width="fill_parent"
              android:layout_height="5dp"
              android:background="@color/seperator" /&gt;
  
          &lt;TextView
              android:id="@+id/txtContactFullName"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="10dip"
              android:ellipsize="end"
              android:maxLines="1"
              android:paddingRight="5dp"
              android:singleLine="true"
              android:textColor="@color/black"
              android:textSize="20sp" /&gt;
  
          &lt;TextView
              android:id="@+id/txtTitle"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="10dip"
              android:ellipsize="end"
              android:maxLines="1"
              android:paddingRight="5dp"
              android:singleLine="true"
              android:textColor="@color/black"
              android:textSize="14sp" /&gt;
  
          &lt;TextView
              android:id="@+id/txtCompany"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="10dip"
              android:layout_marginTop="10dip"
              android:ellipsize="end"
              android:maxLines="1"
              android:paddingRight="5dp"
              android:singleLine="true"
              android:textColor="@color/black"
              android:textSize="14sp" /&gt;
  
          &lt;TextView
              android:id="@+id/txtPosition"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="10dip"
              android:layout_marginLeft="10dip"
              android:ellipsize="end"
              android:maxLines="1"
              android:paddingRight="5dp"
              android:singleLine="true"
              android:textColor="@color/black"
              android:textSize="14sp" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>.....</p>
  
  <p>I tried giving the ll_buttonContainer a transparent background programatically too.</p>
  
  <pre><code>llButtonContainer.setBackgroundColor(mContext.getResources().getColor(
      R.color.transparent_tr));
  
  llButtonContainer.setBackgroundColor(Color.argb(0, 0, 0, 0));
  </code></pre>
  
  <p>I even tried</p>
  
  <pre><code>        android:background="null"        
  </code></pre>
  
  <p>Nothing works. The layout is still visible, it gets any color (red, yellow, white etc.) other than transparent. Is this how it works, will I not be able to give it transparent background due to how Dialog works? </p>
  
  <p>Thanks for any help.</p>