title: Make button background transparent using selector
body: <p>Here we go. I have a button that has a non-pressed state background as transparent. As soon as the button is pressed, the background is no longer transparent (see the pics). I use nine patch for all my images.</p>
  
  <p>This is my selector:</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:drawable="@drawable/starfighterstartbtndown" android:state_pressed="true"/&gt;
      &lt;item android:drawable="@drawable/starfighterstartbtn"/&gt;
  &lt;/selector&gt;
  </code></pre>
  
  <p>And here is the layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
  &lt;ImageView
      android:id="@+id/mainMenuImage"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:scaleType="fitXY"
      android:src="@drawable/starfighter" &gt;
  
  &lt;/ImageView&gt;
  
  &lt;RelativeLayout
      android:id="@+id/buttons"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:layout_marginBottom="20dp"
      android:orientation="horizontal" &gt;
  
      &lt;ImageButton
          android:id="@+id/btnStart"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:background="@android:color/transparent"
          android:clickable="true"
          android:hapticFeedbackEnabled="true"
          android:src="@drawable/startselector" &gt;
  
      &lt;/ImageButton&gt;
  
      &lt;ImageButton
          android:id="@+id/btnExit"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentRight="true"
          android:clickable="true"
          android:src="@drawable/exitselector"
          android:background="@android:color/transparent"
          android:hapticFeedbackEnabled="true" &gt;
      &lt;/ImageButton&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Not Clicked:</p>
  
  <p><img src="https://i.stack.imgur.com/VzF9Q.png" alt="Not Clicked"></p>
  
  <p>Clicked:</p>
  
  <p><img src="https://i.stack.imgur.com/IyMzD.png" alt="Clicked"></p>
  
  <p>I have also tried the following methods with no luck</p>
  
  <pre><code>button.getBackground().setAlpha(0);
  button.setBackgroundColor(Color.TRANSPARENT);
  </code></pre>
  
  <p>Also tried the following inside the onClickListener()</p>
  
  <pre><code>view.getBackground().setAlpha(0);
  view.setBackgroundColor(Color.TRANSPARENT);
  button.getBackground().setAlpha(0);
  button.setBackgroundColor(Color.TRANSPARENT);
  </code></pre>
  
  <p>Still no luck. Good luck :)</p>