Sunday, April 11, 2010

The Missing Manual - Android Drawables from XML

I have been fairly frustrated with a gap in the Android documentation recently - the file formats for creating Drawables from XML. Drawables XML has been pretty useful to me in the past in creating gradients; I'd rather use it than create 9-patches all the time. However, the Android documentation is strangely silent about the format; they provide a few samples, but as far as I know there's nothing beyond that.

I've taken it upon myself to study the source code and create a missing manual for all the possibilities for Drawable XMLs. The data was gathered from the Android source code, from the package. I was surprised to find a lot of really useful code I wish I'd known about a long time ago; regardless, I was able to figure out all of how Drawables XML works.

Without further ado, here it is: the missing manual on Android Drawables via XML. I hope this lessens the pain someone else has slightly.


  1. Epic, I have been looking for something like this for months now. I was already about to take apart the source code myself while researching this for a book I am writing, but looks like you saved me from an evening of frustration. Consider yourself included in the awesome-people-we-like-to-thank-list of one of the better forthcoming Android books :-)

  2. Maybe useful but without example and no explanation ...

    What are Android drawables from XMl and why are they better than 9Patch ?

  3. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    angularjs-Training in velachery

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs Training in btm

    angularjs Training in electronic-city

    angularjs Training in online