Search code examples
androidstatelistdrawable

Android Default Toggle Button Showing Through


I am creating a custom Toggle Button. Even though I've created a custom image, the default Toggle Button graphic still shows through (pictures below). I've created a selector and referenced it using the android:background property.

The selector looks like:

<item android:state_checked="true"
    android:drawable="@drawable/playon" />

<item android:state_checked="false"
    android:drawable="@drawable/playoff" />

<item android:drawable="@drawable/playoff" />

Where @drawable/playoff is http://i41.tinypic.com/sgpugj.png. However, when the toggle button is off it looks like http://i42.tinypic.com/2irap9x.png. As you can see, the "Off" message is "ghosting" as if it still wants to use the default toggle button. Any help on removing this would be greatly appreciated.


Solution

  • I fixed the problem by using both android:button and android:background referencing the same selector.