GuybrushThreepwood GuybrushThreepwood - 10 months ago 58
Java Question

Creating State List Drawable XML for Background - Android

I am trying to get the following state list to work. The idea is to create a white background.

<selector xmlns:android="">
<item android:state_window_focused="false" android:state_selected="true"
android:drawable="@android:color/transparent" />
<item android:state_selected="true" android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:state_selected="false"
android:drawable="@android:color/transparent" />
<item android:state_selected="false" android:drawable="@color/WHITE" />

When I try and compile this I get the following error..

@color/transparent and @color.WHITE don't exist.

Do I need to define these somewhere and if so how ?

Thanks !

Answer Source

try to create a resource file like this:

<?xml version="1.0" encoding="utf-8"?>
<color name="white">#ffffff</color>

let's see if someone knows about transparent one