If you build Android apps, the strike-through is a familiar UI pattern—a line passes through an icon as it transitions from "on" to "off." A small open-source library handles that with one view, one boolean, and a built-in animation. Here's the setup, the limitations, and where it fits in a real app.
The short version
- Source: DamonBaker on GitHub.
- Repository host: JitPack.
- Recommended dependency: com.github.DamonBaker:StrikedImageView:1.0.0.
- Best with: vector drawables.
- Animation toggle: set isStriked on the view.
How to add it to an Android project
The library ships through JitPack. Add the repository URL to your top-level build.gradle, then include a single implementation line in your app-level dependencies block.
After a Gradle sync, drop the view into any layout the same way you'd use an ImageView—just with a different XML tag. The library exposes app:striked and android:tint attributes: the first controls visibility, the second sets the animation color.
How to drive the animation
Find the view, hand it a drawable via setImageDrawable, then flip the isStriked property. The strike-through animates in or out depending on the new value.
A typical use case: a settings row, a toggle, a button that lights up. The icon is on, the strike-through hides it. When the user disables the setting, the strike-through animates across. Two states, two flips, no extra animation code.
The limitations to know about
StrikedImageView works best with vector drawables. With bitmaps, set the strikeColor manually so the strike matches the source image. The same applies to the tint—set it explicitly or the view won't know which color to use.
There's also a background caveat. The library walks up the view hierarchy to find a parent with a ColorDrawable, which it uses as the strike-through background. If your parent isn't a ColorDrawable, set strikeBackgroundColor manually.
Why it matters
This library wins on simplicity: one configurable view instead of a custom animation class. For a settings toggle, a checklist item, or a feature flag panel, it takes minutes to integrate and replaces code you'd otherwise write once and maintain forever.
The trade-offs are clear. Teams using vector drawable systems (Material icons, custom vector sprites) get a clean drop-in. Teams with bitmap-heavy UIs will spend time configuring strikeColor and strikeBackgroundColor on every instance—diminishing the "it just works" appeal.
At version 1.0.0 on JitPack, there's minimal surface area for issues, but the dependency chain warrants attention. Pin the version in your Gradle file and monitor the repo for updates. A breaking change in a UI library ripples fast.
Who should care
| Scenario | Fit |
|---|---|
| Material-style settings toggles with vector icons | ✅ Ideal |
| Feature flag or A/B test panels | ✅ Ideal |
| Custom checklist UIs with drawable states | ✅ Ideal |
| Bitmap-heavy icon systems | ⚠️ Requires manual color config |
| Complex nested view hierarchies | ⚠️ Manual strikeBackgroundColor needed |
Bottom line
A small library that does one thing well. Use it for toggle-style UI with vector drawables, set strikeBackgroundColor when your parent isn't a plain color, and pin the dependency version.
Frequently asked questions
Where is the StrikedImageView library hosted?
It's hosted on JitPack, with the dependency com.github.DamonBaker:StrikedImageView:1.0.0.
Does StrikedImageView work with bitmap images?
It works best with vector drawables. With bitmaps, set strikeColor manually so the strike matches the source image.
How do you trigger the animation in code?
After calling setImageDrawable, set the isStriked boolean on the view—the strike-through animates in or out.
Why does StrikedImageView need a ColorDrawable parent?
The library walks up the view hierarchy to find a parent with a ColorDrawable, which it uses as the strike-through background. If your parent isn't a ColorDrawable, set strikeBackgroundColor manually.
What controls the strike-through color?
Both android:tint and strikeColor affect how the strike-through is drawn. Set the tint explicitly so the view knows which color to use.