Is it possible to have an xml drawable with parameters? Suppose I have an xml drawable that I want to reuse for the rounded corners, gradients etc, and the only variable is a color or two. Is it possible to specify/pass parameters to an xml drawable?
Perhaps you can derive your own class from Drawable, have a constructor accepting the parameters you want to make adjustable and in the constructor first call createFromXML
passing your xml and then setup those adjustable parameters.
I didn't try that myself, perhaps, I'm wrong
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With