tags:

views:

28

answers:

1

Hello everyone, 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"&gt;
       <item
                android:state_pressed="true"
                style="@style/filter_btn" 
                />
        <item
                android:state_pressed="false"
                style="@style/transparent" />
</selector>

Could someone help me ?

A: 

Selectors work only for drawables, not styles.

Reference

Carl Manaster
Damn . Thanks :) Do you have some ideas about how to accomplish this task ?
Andrea Baccega
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