The lesser known world of spans

Do you know what’s common between the blinking cursor, hyperlinks and text highlighting in TextViews? They’re all implemented using spans. Spans are tiny objects that Android uses heavily across the framework.

If you’ve worked with text styling such as bold or italics, then you’re already familiar with the basic usages of spans. But they are capable of much more than just modifying the visual representation of text like changing indentation, receiving URL clicks, listening to text changes, displaying spelling suggestions, images and much more.

This talk does a deep dive into the various spans that Android offers out of the box as well as custom spans and how they can be used for displaying text in any way imaginable.

The slides for this talk can be found here.