Etsy Deniz Veli Jan 13, 2014

Android Staggered Grid Implementation

Article Summary

Deniz Veli from Etsy tackled a problem every Android dev knows: GridView and ListView just don't cut it for complex layouts. So they built their own.

Back in 2014, Etsy's Android team needed a multi-column grid that could display listing cards without cropping images, handle orientation changes gracefully, and support headers/footers. The existing Android components couldn't deliver, so they built AndroidStaggeredGrid from scratch and open-sourced it.

Key Takeaways

Critical Insight

Etsy created a production-ready staggered grid component that solved Android's layout limitations and shared it with the community on GitHub.

The article includes actual code snippets showing exactly how to implement the custom ImageView that makes the whole thing work.

About This Article

Problem

Etsy's Android team needed to display listing cards on phones, tablets, phablets, and tabphones without cropping images. The standard ListView and GridView components didn't have the flexibility they needed.

Solution

Deniz Veli's team created AndroidStaggeredGrid by extending Android's AbsListView source code. They added DynamicHeightImageView to keep aspect ratios correct when the device rotated and to handle rows of different heights.

Impact

The component shipped with the new Etsy for Android app in November 2014. The team later open-sourced it on GitHub through Maven so other developers could use it. After launch, they tracked bugs through Crashlytics using real devices from their test lab.