ListSelector applies to the entire list

I was having this same issue and while looking at one of the platform drawable XML files I noticed a way to eliminate the need to create an image file just for a color, by creating a shape in XML.

For example, instead of:

<item android:state_focused="true"
      android:drawable="@drawable/list_active" />


<item android:state_focused="true">
        <solid android:color="#66000000" />

Beyond just creating a plain color drawable, the shape is flexible, similar to a simple vector object. All the details can be found here:

Leave a Comment