title: Android - How can I create a selector for Layouts (like an ImageButton selector)
body: <p>I have an ImageButton and a LinearLayout wrapping that button, like this:</p>
  
  <pre><code>&lt;LinearLayout
          android:id="@+id/homeButtonLayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@drawable/p_buttons_background"
          android:orientation="vertical" &gt;
  
          &lt;ImageButton
              android:id="@+id/homeButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_margin="10px"
              android:background="@drawable/home_icon"
              android:onClick="goBackToCameraScreen" /&gt;
      &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>I put a background around the ImageButton <strong>in the LinearLayout</strong>, as you can see above.</p>
  
  <p>I want to be able to change that background (that is, <strong>the background of the LinearLayout</strong>, not the background of the ImageButton) when the user clicks on the ImageButton. I could do that programmatically, but I want to do that via XML. I could easily change the background <strong>of the ImageButton</strong> by writing a selector, like this:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
       &lt;item android:state_pressed="true"
         android:drawable="@drawable/button_pressed" /&gt; &lt;!-- pressed --&gt;
       &lt;item android:state_focused="true"
         android:drawable="@drawable/button_focused" /&gt; &lt;!-- focused --&gt;
       &lt;item android:drawable="@drawable/button_normal" /&gt; &lt;!-- default --&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>That's <strong><em>EXACTLY</em></strong> what I want, except that I want to <strong>change the LinearLayout background, and not the ImageButton background</strong>. How can I create a XML selector just like the one above, but that actually changes the background of the LinearLayout instead of the ImageButton background??</p>
  
  <p>Thank you in advance!! =)</p>