getBounds(): the story of Drawables and their View masters

67867d2677e7dd983000441ff0b1c089?s=47 NeiL saitug
September 20, 2014

getBounds(): the story of Drawables and their View masters

At Devoxx 2013, Cyril Mottier gave a great talk on Mastering Android Drawables. Hoping to build on that talk and go a bit more indepth into how to actually implement a custom drawable. What is a Drawable? How do you make one? How do they interact with their Views. Lisa’s got a few stories to share about writing a custom Drawable type from scratch. Do you know the difference between getMinimumHeight vs getIntrinsicHeight, and more importantly why making custom Drawables is painful. We’ll talk about the native Drawable types, how custom Drawables can be included in XML (hint, they can’t), the nuts and bolts of how Drawable instances share their constant state (So why bitmap images for Drawables get shared). Finally, we’ll go into the relationship between views and drawables -- how do drawables’ size get set, and what’s the difference between using a ColorDrawable versus a BitmapDrawable with respect to the View that is using the Drawable as a view backing.

Collaboration with Jamie Huson (@jamiehuson)

Presented at DroidCon NYC 2014 on Sept 20


NeiL saitug

September 20, 2014