13

I would like to create an xml selector of styles.

Basically i would do something like that:

<selector xmlns:android="http://schemas.android.com/apk/res/android">  
  <item android:state_pressed="true"
      style="@style/filter_btn"/>
  <item android:state_pressed="false"
      style="@style/transparent" />
</selector>

Could someone help me ?

Haresh Chaudhary
  • 4,390
  • 1
  • 34
  • 57
Andrea Baccega
  • 27,211
  • 13
  • 45
  • 46

1 Answers1

10

Selectors work only for drawables, not styles.

Reference

Carl Manaster
  • 39,912
  • 17
  • 102
  • 155
  • 1
    Damn . Thanks :) Do you have some ideas about how to accomplish this task ? – Andrea Baccega Sep 08 '10 at 11:57
  • I'm afraid the only option I've seen is to handle it in code. And I've found it easier, in those situations, to handle all of the changes in code, rather than splitting what can be handled in xml (drawables) there, and just the rest in code. If I can't do it all with a `selector`, I just make the changes in code. – Carl Manaster Sep 08 '10 at 14:32