Search code examples
androiddrawablexml-drawable

Is it possible to set the background of Drawable to a Drawable class name in XML?


I found some code in our project where someone is iterating over the children of a ViewGroup so they can set a custom Java-based drawable as the background. I'd like to clean that up a bit by setting the background drawable in our layout XML files.

Is there a way to specify a Java class to use as the background via the XML layout definition?


Solution

  • After looking around quite a bit I was unable to find a way to do this. I had to specify the background drawable in code.