title: Why is my 'transparent' overlay view opaque?
body: <p>I have a single activity with a simple layout (a bunch of coloured panels) and I'm trying to overlay a small moving graphic on a transparent view over the top. Like @umar <a href="https://stackoverflow.com/questions/6565806/transparent-panel-in-activity">here</a> I'm following <a href="http://www.androidapps.org/tag/mapview" rel="nofollow noreferrer">this tutorial</a> but my overlay view is refusing to be transparent. I can make the view appear, it contains just what it should, but the background of the view is black and however I try to make it transparent fails. I've tried a few of the solutions mentioned on SO and it always comes out the same.</p>
  
  <p>My layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/everything"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:background="#00ffffff"
  &gt;
  
  &lt;LinearLayout
      android:id="@+id/row_1_bg"
      android:layout_width="fill_parent"
      android:layout_height="0dip"
      android:layout_weight="1"
      android:orientation="horizontal"
      &gt;
  
      &lt;FrameLayout
          android:layout_height="fill_parent"
          android:layout_width="100dp"
          &gt;
  
          &lt;LinearLayout
              android:id="@+id/row_1_table"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical"
              android:background="#808080"
              &gt;
  
              &lt;LinearLayout
                  android:layout_width="fill_parent"
                  android:layout_height="0dip"
                  android:layout_weight="1"
                  android:orientation="horizontal"
                  &gt;
  
              &lt;TextView  
                  android:id="@+id/row_1_pantone"
                  android:paddingLeft="6dip"
                  android:textColor="#f0f0f0"
                  android:textStyle="bold"
                  android:gravity="center_vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  &gt;
              &lt;/TextView&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="0dip"
              android:layout_weight="1"
              android:orientation="horizontal"
              &gt;
              &lt;TextView  
                  android:id="@+id/row_1_rgb"
                  android:paddingLeft="6dip"
                  android:textColor="#f0f0f0"
                  android:textStyle="bold"
                  android:gravity="center_vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  &gt;
              &lt;/TextView&gt;
          &lt;/LinearLayout&gt;
          &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="0dip"
              android:layout_weight="1"
              android:orientation="horizontal"
              &gt;
              &lt;TextView  
                  android:id="@+id/row_1_hex"
                  android:paddingLeft="6dip"
                  android:textColor="#f0f0f0"
                  android:textStyle="bold"
                  android:gravity="center_vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  &gt;
              &lt;/TextView&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/FrameLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout 
  android:layout_height="fill_parent" 
  android:layout_width="fill_parent" 
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:paddingRight="5px" 
  android:paddingTop="5px" 
  android:paddingLeft="5px" 
  android:gravity="bottom" 
  android:orientation="vertical"
  android:background="#00808080"&gt; 
  
  &lt;barry.pantone.TransparentPanel 
          android:layout_height="wrap_content" 
          android:layout_width="fill_parent" 
          android:id="@+id/transparent_panel" 
          android:paddingRight="5px" 
          android:paddingTop="5px" 
          android:paddingLeft="5px" 
          android:paddingBottom="5px"
          android:background="#00808080"&gt; 
  
          &lt;Button 
              android:layout_height="wrap_content" 
              android:layout_width="wrap_content" 
              android:id="@+id/button_click_me" 
              android:text="Click Me!"
              /&gt; 
  &lt;/barry.pantone.TransparentPanel&gt; 
  &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>My TransparentPanel.java is straight from the tutorial, using:</p>
  
  <pre><code>innerPaint.setARGB(225, 75, 75, 75);
  </code></pre>
  
  <p>to make a transparent panel, and this is my onCreate from the main activity:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      Resources res = getResources();
      sPantone = res.getStringArray(R.array.pantone); // gets colour definitions
  
      iHeight = getWindowManager().getDefaultDisplay().getHeight();
  
      PopulateTable (); // draws colours in the various layout elements
      }
  </code></pre>
  
  <p>The problem is that whatever I do inside the view is fine - I can draw a semi transparent panel over other elements <strong>in that view</strong>, but the overlay view itself has a black background which obscures the layout beneath. If anyone can help me understand why transparency doesn't work, I will be eternally grateful.</p>
  
  <p>Many thanks</p>
  
  <p>Baz</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Following another idea I tried moving the definition of the overlay out into its own XML file and using a LayoutInflater to inflate and add the new view. Nope. Exactly the same - the additional view has a solid background. Here's the tranny.xml layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
  android:background="#80000040"
  android:layout_height="fill_parent" 
  android:layout_width="fill_parent" 
  xmlns:android="http://schemas.android.com/apk/res/android" 
  android:paddingRight="5dip" 
  android:paddingTop="5dip" 
  android:paddingLeft="5dip" 
  android:gravity="bottom" 
  android:orientation="vertical"
  &gt; 
  &lt;Button 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:id="@+id/button_click_me" 
      android:text="Click Me!"
      /&gt; 
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>and here's the code from onCreate to inflate the new view and add it to the main layout:</p>
  
  <pre><code>private View view;
  ViewGroup parent = (ViewGroup) findViewById(R.id.everything);
  view = LayoutInflater.from(getBaseContext()).inflate(R.layout.tranny, parent, false);
  parent.addView(view);
  </code></pre>
  
  <p>Basically I've gone about creating exactly the same result using a different technique. Handy to learn about LayoutInflater for the first time, but no help re transparency :(</p>