finds.dev← search

// the find

romainguy/elegant-underline-android

★ 808 · Java · Apache-2.0 · updated Jun 2016

Exploring possible implementations for better underline text decoration on Android

A small sample app from Romain Guy (ex-Android framework team) demonstrating two ways to draw a nicer underline than the default TextView/Paint underline on Android — one using Path and API 19, one using Region and going back to API 1. It's for Android devs who've hit the classic 'underline collides with descenders' problem and want to see the actual drawing code, not a library to drop into a project.

The two approaches are a genuinely useful comparison — seeing the Region-based hack next to the cleaner Path-based API shows the tradeoff between backward compatibility and code simplicity. It's small enough to read end to end in a few minutes: the whole logic lives in one UnderlineView.java. Coming from Romain Guy, the Canvas/Path manipulation is idiomatic and worth studying as a reference for custom text rendering on Android.

Dead since 2016 — no Kotlin, no AndroidX, no Gradle version anyone runs today, so it won't build without manual fixes to settings.gradle and the Gradle wrapper. It's a demo activity, not a reusable component — there's no API surface, no CustomSpan you can drop into existing text, and no tests. Anyone wanting this today is better off using the modern LineBackgroundSpan/Paint approach or Compose's TextDecoration, which solved this more generally since this repo was written.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →