title: Android -- Hiding Views
body: <p>Okay, so I've done some looking around and I see how you are SUPPOSED to do it, but for me, it is just not working.</p>
  
  <p>I need to be able to set the alpha of a RelativeLayout both in XML and in code. For my XML, I have the following</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/player_controls"
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      android:alpha="0.0"&gt;
      &lt;RelativeLayout
          android:layout_height="match_parent"
          android:layout_width="match_parent"
          android:id="@+id/player_controls_touch_me"
          &gt;
          &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I get the error: <code>no resource identifier found for attribute 'alpha' in package 'android'</code></p>
  
  <p>Also, based on the Android documentation, I should be able to call <code>setAlpha(double)</code> on any View object, but when I try to make that call on a RelativeLayout it tells me that this method is not defined for this object. </p>
  
  <p>Why am I not able to control the alpha transparency for a RelativeLayout object in Android? Am i missing something? Thanks!</p>
  
  <p><strong>Update</strong> </p>
  
  <p>Although using the visibility property works, it prevents me from be able to click on the ViewGroup. This is important for me because I am utilizing the OnTouchListener of the ViewGroup. </p>
  
  <p>What I am trying to do is to have a layer with media controls, initially hidden. when the user taps anywere on the screen, I want the controls to fade in and when they tap the screen again I want the controls to fade out. I have this part already working. I am using a viewgroup that sits over-top my entire application with an OnTouchListener attached that can determine if it has or hasn't been touched. My problem is that after the animation runs to fade out the controls, they re-appear. If I use @Hydrangea suggestion, I can have it fade out and immediately made invisible. This gives me the desired effect, but then the ViewGroup is unclickable and the user cannot get the controls to come back (or go away, depending on what we decide to do first).</p>
  
  <p>I hope this makes sense. </p>