11

In my application,I have 4 ImageButtons and each ImageButton have different source image based on their states.So maintaining 4 separate xml files for each of the button.

Is there any way to write all the selectors in a single xml file ?

Dileep Perla
  • 1,865
  • 7
  • 33
  • 54
  • where is the problem in having 3 extra files? – banzai86 Jun 12 '12 at 06:43
  • Multiple files can get very unwieldy very quickly. It'd be nice to be able to organize these in a hierarchical way rather than having to rely on long filenames (and hope they are maintained correctly!). – SMBiggs Nov 04 '21 at 14:31

1 Answers1

11

Not it's not possible:

The documentation says: A StateListDrawable is a drawable object defined in XML that uses a several different images to represent the same graphic, depending on the state of the object.

note here: same graphic

src: Drawable Resources

AZ13
  • 14,397
  • 5
  • 35
  • 31