views:

41

answers:

1

I see examples of selectors using android states like 'selected' to define style. Here a simplified example:

<selector>
    <item android:state_selected="true" android:drawable="@color/transparent" />
    <item android:drawable="@drawable/listitem_normal" />
</selector>

So, my question is: Can I define and use my own state instead of

android:state_selected="true"

My goal is to color shapes based on an integer value, like simple version of this heatmap: alt text

+2  A: 

Take a look onto LevelList and LevelListDrawable, it looks like the drawable is what you need.

Konstantin Burov