I want to set the color of row in listview if selected to yellow and otherwise be white so I use the following selector
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_enabled="true"
android:state_pressed="true" android:drawable="@color/encounter_normal" />
<item android:state_enabled="true"
android:state_focused="true" android:drawable="@color/encounter_normal" />
<item android:state_enabled="true"
android:state_selected="true" android:drawable="@color/encounterselector_color" />
<item
android:drawable="@color/encounter_normal" />
</selector>
where
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="encounterselector_color">#fbeda5</color>
<color name="encounter_normal">#ffffff</color>
</resources>
and I use it like the following
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/EncounterGrid"
android:background="@drawable/encounterlistview"
>
<!-- remaining code -->
but the row is always white , any idea how to fix that