user944351
user944351

Reputation: 1213

Android ListView Item Selector appear for the whole list

i want to change the default selection color of my listview items in my list as followed:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_focused="true" 
        android:state_pressed="false"
        android:drawable="@color/Blue" />
    <item android:state_focused="false" 
        android:state_pressed="true"
        android:drawable="@color/Black" />
   <item android:drawable="@color/White" />
</selector> 

then i set the selecotor to my list using

android:listSelector="@drawable/list_item_selector"

the problem is when i want to set the selector as shown above, the selection is not applied to the single item but to the whole list.

can anybody help me please?

Upvotes: 0

Views: 827

Answers (1)

MGK
MGK

Reputation: 7098

Try setting this as background to individual item in your list.

Upvotes: 3

Related Questions