Reputation: 658
I need a drawable where contain several other drawables and let me choose one of them to show at runtime, I think a DrawableContainer is a good choice to achieve this, but I don't know how to create a DrawableContainer in XML, I tried to use selector(StateDrawable) witch is a subclass of DrawableContainer, but I couldn't add items with the same properties.
Upvotes: 0
Views: 368
Reputation: 7123
As it's name suggests, a DrawableContainer is nothing beyond a collection of drawables. As to how the drawables work together is defined by subclasses like the StateListDrawable (change drawables based on the state), a LayerListDrawable (draw drawables over each other) etc. So you cant really use a DrawableContainer in itself.
Documentation:
A helper class that contains several Drawables and selects which one to use. You can subclass it to create your own DrawableContainers or directly use one its child classes.
Upvotes: 1