tags:

views:

28

answers:

1

I have an image selector that has the "pressed" state set to a particular drawable. I want to give the user the opportunity to change this on the fly. However, I have found no way to programmatically get and modify a selector.

Is this something that is not supported?

+1  A: 

Selectors, Like all Android resources, go through some compile-time processing that optimizes the XML for efficient run-time parsing. You can't dynamically edit the resources like you propose.

AFAIK the only way to achieve what you want is either manually implement the drawable selection in a custom image selector (not much fun) or limit the users options and have a pre-built collection of selectors that you can switch between at the user's discretion.

CodeFusionMobile