title: Replace the bottom layer in a toggle button
body: <p>I am relatively new to Android programming. I am trying to create a toggle button with an image as a background. </p>
  
  <pre><code>&lt;ToggleButton
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      android:id="@+id/toggleButton"
      android:textOn="@string/text_toggle_off"
      android:textOff="@string/text_toggle_on"
      android:onClick="onToggleClicked"
      android:layout_centerVertical="true"
      android:background="@drawable/ic_off"/&gt;
  </code></pre>
  
  <p>As the button state changes, I replace the image programatically:</p>
  
  <pre><code>public void onToggleClicked(View view) {
      boolean on = ((ToggleButton) view).isChecked();
      if (on) {
          ((ToggleButton) view).setBackground(getResources().getDrawable(R.drawable.ic_on));
      } else {
          ((ToggleButton) view).setBackground(getResources().getDrawable(R.drawable.ic_off));
      }
  }
  </code></pre>
  
  <p>The problem is that the base layer of the ToggleButton changes color with the state. I always want to base layer to be transparent. Is there an easy way to do this through the Java code?</p>